15 Feb, 2017

1 commit

  • commit da7061c82e4a1bc6a5e134ef362c86261906c860 upstream.

    The function ieee80211_ie_split_vendor doesn't return 0 on errors. Instead
    it returns any offset < ielen when WLAN_EID_VENDOR_SPECIFIC is found. The
    return value in mesh_add_vendor_ies must therefore be checked against
    ifmsh->ie_len and not 0. Otherwise all ifmsh->ie starting with
    WLAN_EID_VENDOR_SPECIFIC will be rejected.

    Fixes: 082ebb0c258d ("mac80211: fix mesh beacon format")
    Signed-off-by: Thorsten Horstmann
    Signed-off-by: Mathias Kretschmer
    Signed-off-by: Simon Wunderlich
    [sven@narfation.org: Add commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Thorsten Horstmann
     

26 Jan, 2017

1 commit

  • commit eeb0d56fab4cd7848cf2be6704fa48900dbc1381 upstream.

    In AP (or VLAN) mode, when unicast 802.11 packets are received,
    they might actually be multicast after conversion. In this case
    the fast-RX path didn't handle them properly to send them back
    to the wireless medium. Implement that by copying the SKB and
    sending it back out.

    The possible alternative would be to just punt the packet back
    to the regular (slow) RX path, but since we have almost all of
    the required code here already it's not so complicated to add
    here. Punting it back would also mean acquiring the spinlock,
    which would be bad for the stated purpose of the fast-RX path,
    to enable well-performing parallel RX.

    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

12 Jan, 2017

2 commits

  • commit 1c3d185a9a0b136a58e73b02912d593d0303d1da upstream.

    On drivers setting the SUPPORTS_REORDERING_BUFFER hardware flag,
    we crash when the peer sends an AddBA request while we already
    have a session open on the seame TID; this is because on those
    drivers, the tid_agg_rx is left NULL even though the session is
    valid, and the agg_session_valid bit is set.

    To fix this, store the dialog tokens outside the tid_agg_rx to
    be able to compare them to the received AddBA request.

    Fixes: f89e07d4cf26 ("mac80211: agg-rx: refuse ADDBA Request with timeout update")
    Reported-by: Emmanuel Grumbach
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • commit 35f432a03e41d3bf08c51ede917f94e2288fbe8c upstream.

    In ieee80211_xmit_fast(), 'info' is initialized to point to the skb
    that's passed in, but that skb may later be replaced by a clone (if
    it was shared), leading to an invalid pointer.

    This can lead to use-after-free and also later crashes since the
    real SKB's info->hw_queue doesn't get initialized properly.

    Fix this by assigning info only later, when it's needed, after the
    skb replacement (may have) happened.

    Reported-by: Ben Greear
    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

09 Jan, 2017

1 commit

  • commit e6f462df9acd2a3295e5d34eb29e2823220cf129 upstream.

    When mac80211 abandons an association attempt, it may free
    all the data structures, but inform cfg80211 and userspace
    about it only by sending the deauth frame it received, in
    which case cfg80211 has no link to the BSS struct that was
    used and will not cfg80211_unhold_bss() it.

    Fix this by providing a way to inform cfg80211 of this with
    the BSS entry passed, so that it can clean up properly, and
    use this ability in the appropriate places in mac80211.

    This isn't ideal: some code is more or less duplicated and
    tracing is missing. However, it's a fairly small change and
    it's thus easier to backport - cleanups can come later.

    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

15 Nov, 2016

5 commits

  • A-MSDU aggregation alters the QoS header after a frame has been
    enqueued, so it needs to be ready before enqueue and not overwritten
    again afterwards

    Fixes: bb42f2d13ffc ("mac80211: Move reorder-sensitive TX handlers to after TXQ dequeue")
    Signed-off-by: Felix Fietkau
    Acked-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Felix Fietkau
     
  • The call to ieee80211_txq_enqueue overwrites the vif pointer with the
    codel enqueue time, so setting it just before that call makes no sense.

    Signed-off-by: Felix Fietkau
    Acked-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Felix Fietkau
     
  • The sequence number counter is used to derive the starting sequence
    number. Since that counter is updated on tx dequeue, the A-MPDU flag
    needs to be up to date at the tme of dequeue as well.

    This patch prevents sending more A-MPDU frames after the session has
    been terminated and also ensures that aggregation starts right after the
    session has been established

    Fixes: bb42f2d13ffc ("mac80211: Move reorder-sensitive TX handlers to after TXQ dequeue")
    Signed-off-by: Felix Fietkau
    Acked-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Felix Fietkau
     
  • This reverts commit c68df2e7be0c1238ea3c281fd744a204ef3b15a0.

    __sta_info_recalc_tim turns into a no-op if local->ops->set_tim is not
    set. This prevents the beacon TIM bit from being set for all drivers
    that do not implement this op (almost all of them), thus thoroughly
    essential AP mode powersave functionality.

    Cc: Emmanuel Grumbach
    Fixes: c68df2e7be0c ("mac80211: allow using AP_LINK_PS with mac80211-generated TIM IE")
    Signed-off-by: Felix Fietkau
    Signed-off-by: Johannes Berg

    Felix Fietkau
     
  • This is a workaround for VHT-enabled STAs which break the spec
    and have the VHT-MCS Rx map filled in with value 3 for all eight
    spacial streams, an example is AR9462 in AP mode.

    As per spec, in section 22.1.1 Introduction to the VHT PHY
    A VHT STA shall support at least single spactial stream VHT-MCSs
    0 to 7 (transmit and receive) in all supported channel widths.

    Some devices in STA mode will get firmware assert when trying to
    associate, examples are QCA9377 & QCA6174.

    Packet example of broken VHT Cap IE of AR9462:

    Tag: VHT Capabilities (IEEE Std 802.11ac/D3.1)
    Tag Number: VHT Capabilities (IEEE Std 802.11ac/D3.1) (191)
    Tag length: 12
    VHT Capabilities Info: 0x00000000
    VHT Supported MCS Set
    Rx MCS Map: 0xffff
    .... .... .... ..11 = Rx 1 SS: Not Supported (0x0003)
    .... .... .... 11.. = Rx 2 SS: Not Supported (0x0003)
    .... .... ..11 .... = Rx 3 SS: Not Supported (0x0003)
    .... .... 11.. .... = Rx 4 SS: Not Supported (0x0003)
    .... ..11 .... .... = Rx 5 SS: Not Supported (0x0003)
    .... 11.. .... .... = Rx 6 SS: Not Supported (0x0003)
    ..11 .... .... .... = Rx 7 SS: Not Supported (0x0003)
    11.. .... .... .... = Rx 8 SS: Not Supported (0x0003)
    ...0 0000 0000 0000 = Rx Highest Long GI Data Rate (in Mb/s, 0 = subfield not in use): 0x0000
    Tx MCS Map: 0xffff
    ...0 0000 0000 0000 = Tx Highest Long GI Data Rate (in Mb/s, 0 = subfield not in use): 0x0000

    Signed-off-by: Filip Matusiak
    Signed-off-by: Johannes Berg

    Filip Matusiak
     

17 Oct, 2016

1 commit

  • Some crypto implementations (such as the generic CCM wrapper in crypto/)
    use scatterlists to map fields of private data in their struct aead_req.
    This means these data structures cannot live in the vmalloc area, which
    means that they cannot live on the stack (with CONFIG_VMAP_STACK.)

    This currently occurs only with the generic software implementation, but
    the private data and usage is implementation specific, so move the whole
    data structures off the stack into heap by allocating every time we need
    to use them.

    In addition, take care not to put any of our own stack allocations into
    scatterlists. This involves reserving some extra room when allocating the
    aead_request structures, and referring to those allocations in the scatter-
    lists (while copying the data from the stack before the crypto operation)

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Johannes Berg

    Ard Biesheuvel
     

12 Oct, 2016

5 commits

  • When using IEEE 802.11r FT OVER-DS roaming with AP_VLAN, hostapd needs to
    send out a frame using CMD_FRAME for a station assigned to an AP_VLAN
    interface.

    Right now, the userspace needs to give the exact AP_VLAN interface index
    for CMD_FRAME; hostapd does not do this. Additionally, userspace cannot
    use GET_STATION to query the AP_VLAN ifidx, as while GET_STATION finds
    stations assigned to AP_VLAN even if the AP iface is queried, it does not
    return AP_VLAN ifidx (it returns the queried one).

    This breaks IEEE 802.11r over_ds with vlans, as the reply frame does not
    get out. This patch fixes this by using get_sta_bss for CMD_FRAME.

    Signed-off-by: Michael Braun
    Signed-off-by: Johannes Berg

    Michael Braun
     
  • As pointed out by Michael Braun, we don't check inner L2 addresses
    during A-MSDU decapsulation, leading to the possibility that, for
    example, a station associated to an AP sends frames as though they
    came from somewhere else.

    Fix this problem by letting cfg80211 validate the addresses, as
    indicated by passing in the ones that need to be validated.

    Reported-by: Michael Braun
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • We should not accept arbitrary DA/SA inside A-MSDUs, it could be used
    to circumvent protections, like allowing a station to send frames and
    make them seem to come from somewhere else.

    Add the necessary infrastructure in cfg80211 to allow such checks, in
    further patches we'll start using them.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • There's only a single case where has_80211_header is passed as true,
    which is in mac80211. Given that there's only simple code that needs
    to be done before calling it, export that function from cfg80211
    instead and let mac80211 call it itself.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • In mac80211, multicast A-MSDUs are accepted in many cases that
    they shouldn't be accepted in:
    * drop A-MSDUs with a multicast A1 (RA), as required by the
    spec in 9.11 (802.11-2012 version)
    * drop A-MSDUs with a 4-addr header, since the fourth address
    can't actually be useful for them; unless 4-address frame
    format is actually requested, even though the fourth address
    is still not useful in this case, but ignored

    Accepting the first case, in particular, is very problematic
    since it allows anyone else with possession of a GTK to send
    unicast frames encapsulated in a multicast A-MSDU, even when
    the AP has client isolation enabled.

    Cc: stable@vger.kernel.org
    Signed-off-by: Johannes Berg

    Johannes Berg
     

04 Oct, 2016

1 commit

  • Resolve the merge conflict between Felix's/my and Toke's patches
    coming into the tree through net and mac80211-next respectively.
    Most of Felix's changes go away due to Toke's new infrastructure
    work, my patch changes to "goto begin" (the label wasn't there
    before) instead of returning NULL so flow control towards drivers
    is preserved better.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

30 Sep, 2016

11 commits

  • The TXQ intermediate queues can cause packet reordering when more than
    one flow is active to a single station. Since some of the wifi-specific
    packet handling (notably sequence number and encryption handling) is
    sensitive to re-ordering, things break if they are applied before the
    TXQ.

    This splits up the TX handlers and fast_xmit logic into two parts: An
    early part and a late part. The former is applied before TXQ enqueue,
    and the latter after dequeue. The non-TXQ path just applies both parts
    at once.

    Because fragments shouldn't be split up or reordered, the fragmentation
    handler is run after dequeue. Any fragments are then kept in the TXQ and
    on subsequent dequeues they take precedence over dequeueing from the FQ
    structure.

    This approach avoids having to scatter special cases all over the place
    for when TXQ is enabled, at the cost of making the fast_xmit and TX
    handler code slightly more complex.

    Signed-off-by: Toke Høiland-Jørgensen
    [fix a few code-style nits, make ieee80211_xmit_fast_finish void,
    remove a useless txq->sta check]
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • The old value was 30ms, which means mesh sync will treat
    any value below as merely TSF drift. This isn't really
    reasonable (typical drift is < 10us/s) since people
    probably want to adjust TSF in smaller increments (for ie.
    beacon collision avoidance) without mesh sync fighting
    back.

    Change max drift adjustment to 0.8ms, so manual TSF
    adjustments can be made in 1ms increments, with some
    margin.

    Signed-off-by: Thomas Pedersen
    Signed-off-by: Johannes Berg

    Pedersen, Thomas
     
  • This allows the mesh sync (and debugfs) code to make incremental
    TSF adjustments, avoiding any uncertainty introduced by delay in
    programming absolute TSF.

    Signed-off-by: Thomas Pedersen
    Signed-off-by: Johannes Berg

    Pedersen, Thomas
     
  • Small devices can run out of memory from queueing too many packets. If
    VHT is not supported by the PHY, having more than 4 MBytes of total
    queue in the TXQ intermediate queues is not needed, and so we can safely
    limit the memory usage in these cases and avoid OOM.

    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • Add memory limit, usage and overlimit counter to per-PHY 'aqm' debugfs
    file.

    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • Provide an API to report NAN function match. Mac80211 will lookup the
    corresponding cookie and report the match to cfg80211.

    Signed-off-by: Andrei Otcheretianski
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Ayala Beker
     
  • Implement add/rm_nan_func functions and handle NAN function
    termination notifications. Handle instance_id allocation for
    NAN functions and implement the reconfig flow.

    Signed-off-by: Andrei Otcheretianski
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Ayala Beker
     
  • Implement nan_change_conf callback which allows to change current
    NAN configuration (master preference and dual band operation).
    Store the current NAN configuration in sdata, so it can be used
    both to provide the driver the updated configuration with changes
    and also it will be used in hw reconfig flows in next patches.

    Signed-off-by: Andrei Otcheretianski
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Ayala Beker
     
  • This code doesn't do much besides allowing to start and
    stop the vif.

    Signed-off-by: Andrei Otcheretianski
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Ayala Beker
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Ayala Beker
     
  • This allows user space to start/stop NAN interface.
    A NAN interface is like P2P device in a few aspects: it
    doesn't have a netdev associated to it.
    Add the new interface type and prevent operations that
    can't be executed on NAN interface like scan.

    Define several attributes that may be configured by user space
    when starting NAN functionality (master preference and dual
    band operation)

    Signed-off-by: Andrei Otcheretianski
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Ayala Beker
     
  • The TXQ path restructure requires ieee80211_tx_dequeue() to call TX
    handlers and parts of the xmit_fast path. Move the function to later in
    tx.c in preparation for this.

    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     

23 Sep, 2016

1 commit


20 Sep, 2016

1 commit

  • mac80211 currently uses rhashtable with insecure_elasticity set
    to true. The latter is because of duplicate objects. What's
    more, mac80211 walks the rhashtable chains by hand which is broken
    as rhashtable may contain multiple tables due to resizing or
    rehashing.

    This patch fixes it by converting it to the newly added rhltable
    interface which is designed for use with duplicate objects.

    With rhltable a lookup returns a list of objects instead of a
    single one. This is then fed into the existing for_each_sta_info
    macro.

    This patch also deletes the sta_addr_hash function since rhashtable
    defaults to jhash.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

19 Sep, 2016

1 commit

  • …inux/kernel/git/jberg/mac80211-next

    Johannes Berg says:

    ====================
    This time we have various things - all across the board:
    * MU-MIMO sniffer support in mac80211
    * a create_singlethread_workqueue() cleanup
    * interface dump filtering that was documented but not implemented
    * support for the new radiotap timestamp field
    * send delBA in two unexpected conditions (as required by the spec)
    * connect keys cleanups - allow only WEP with index 0-3
    * per-station aggregation limit to work around broken APs
    * debugfs improvement for the integrated codel algorithm
    and various other small improvements and cleanups.
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     

16 Sep, 2016

1 commit

  • In 46fa38e84b65 ("mac80211: allow software PS-Poll/U-APSD with
    AP_LINK_PS"), Johannes allowed to use mac80211's code for handling
    stations that go to PS or send PS-Poll / uAPSD trigger frames for
    devices that enable RSS.

    This means that mac80211 doesn't look at frames anymore but rather
    relies on a notification that will come from the device when a PS
    transition occurs or when a PS-Poll / trigger frame is detected by
    the device.

    iwlwifi will need this capability but still needs mac80211 to take
    care of the TIM IE. Today, if a driver sets AP_LINK_PS, mac80211
    will not update the TIM IE. Change mac80211 to check existence of
    the set_tim driver callback rather than using AP_LINK_PS to decide
    if the driver handles the TIM IE internally or not.

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Luca Coelho
    [reword commit message a bit]
    Signed-off-by: Johannes Berg

    Emmanuel Grumbach
     

15 Sep, 2016

7 commits

  • Based on consecutive msdu failures, mac80211 triggers CQM packet-loss
    mechanism. Drivers like ath10k that have its own connection monitoring
    algorithm, offloaded to firmware for triggering station kickout. In case
    of station kickout, driver will report low ack status by mac80211 API
    (ieee80211_report_low_ack).

    This flag will enable the driver to completely rely on firmware events
    for station kickout and bypass mac80211 packet loss mechanism.

    Signed-off-by: Rajkumar Manoharan
    Signed-off-by: Johannes Berg

    Rajkumar Manoharan
     
  • No drivers implement this, relying either on the recursive
    directory removal to remove their debugfs, or not having any
    to start with. Remove the dead driver callback.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • If chanctx is derived as container_of() from a non-NULL pointer,
    it can't ever be NULL. Since we checked conf before, that's true
    here, so remove the useless NULL check.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • The next line overwrites this assignment, so remove it; there's
    no real value in using it for the next assignment either.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Passing the 'info' pointer where a 'info->aborted' is expected will
    always lead to tracing to erroneously record that the scan was aborted,
    fix that by passing the correct info->aborted. The remaining data will
    be collected in cfg80211, so I haven't duplicated it here.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • In the unlikely situation that the supplicant has negotiated
    admission for the background AC (which it has no reason to as
    it's not supposed to be requiring admission control to start
    with, and we'd ignore such a requirement anyway), the loop
    here may terminate with non_acm_ac == 4, which leads to an
    array overrun.

    Check this explicitly just for completeness.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Since mac80211 doesn't currently support TSIDs 8-15 which can
    only be used after QoS TSPEC negotiation (and not even after
    WMM negotiation), reject attempts to set up aggregation
    sessions for them, which might confuse drivers. In mac80211
    we do correctly handle that, but the TSIDs should never get
    used anyway, and drivers might not be able to handle it.

    Cc: stable@vger.kernel.org
    Signed-off-by: Johannes Berg

    Johannes Berg
     

14 Sep, 2016

1 commit

  • The A-MSDU TX code (within TXQs) didn't always check the return value
    of skb_linearize() properly, resulting in potentially passing a frag-
    list SKB down to the driver even when it said it can't handle it. Fix
    that.

    Fixes: 6e0456b545456 ("mac80211: add A-MSDU tx support")
    Signed-off-by: Johannes Berg

    Johannes Berg