30 Oct, 2020

1 commit

  • There's a race condition in the netdev registration in that
    NETDEV_REGISTER actually happens after the netdev is available,
    and so if we initialize things only there, we might get called
    with an uninitialized wdev through nl80211 - not using a wdev
    but using a netdev interface index.

    I found this while looking into a syzbot report, but it doesn't
    really seem to be related, and unfortunately there's no repro
    for it (yet). I can't (yet) explain how it managed to get into
    cfg80211_release_pmsr() from nl80211_netlink_notify() without
    the wdev having been initialized, as the latter only iterates
    the wdevs that are linked into the rdev, which even without the
    change here happened after init.

    However, looking at this, it seems fairly clear that the init
    needs to be done earlier, otherwise we might even re-init on a
    netns move, when data might still be pending.

    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20201009135821.fdcbba3aad65.Ie9201d91dbcb7da32318812effdc1561aeaf4cdc@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     

28 Sep, 2020

1 commit

  • Support 6 GHz scanning, by
    * a new scan flag to scan for colocated BSSes advertised
    by (and found) APs on 2.4 & 5 GHz
    * doing the necessary reduced neighbor report parsing for
    this, to find them
    * adding the ability to split the scan request in case the
    device by itself cannot support this.

    Also add some necessary bits in mac80211 to not break with
    these changes.

    Signed-off-by: Tova Mussai
    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20200918113313.232917c93af9.Ida22f0212f9122f47094d81659e879a50434a6a2@changeid
    Signed-off-by: Johannes Berg

    Tova Mussai
     

08 Aug, 2020

1 commit

  • As said by Linus:

    A symmetric naming is only helpful if it implies symmetries in use.
    Otherwise it's actively misleading.

    In "kzalloc()", the z is meaningful and an important part of what the
    caller wants.

    In "kzfree()", the z is actively detrimental, because maybe in the
    future we really _might_ want to use that "memfill(0xdeadbeef)" or
    something. The "zero" part of the interface isn't even _relevant_.

    The main reason that kzfree() exists is to clear sensitive information
    that should not be leaked to other future users of the same memory
    objects.

    Rename kzfree() to kfree_sensitive() to follow the example of the recently
    added kvfree_sensitive() and make the intention of the API more explicit.
    In addition, memzero_explicit() is used to clear the memory to make sure
    that it won't get optimized away by the compiler.

    The renaming is done by using the command sequence:

    git grep -w --name-only kzfree |\
    xargs sed -i 's/kzfree/kfree_sensitive/'

    followed by some editing of the kfree_sensitive() kerneldoc and adding
    a kzfree backward compatibility macro in slab.h.

    [akpm@linux-foundation.org: fs/crypto/inline_crypt.c needs linux/slab.h]
    [akpm@linux-foundation.org: fix fs/crypto/inline_crypt.c some more]

    Suggested-by: Joe Perches
    Signed-off-by: Waiman Long
    Signed-off-by: Andrew Morton
    Acked-by: David Howells
    Acked-by: Michal Hocko
    Acked-by: Johannes Weiner
    Cc: Jarkko Sakkinen
    Cc: James Morris
    Cc: "Serge E. Hallyn"
    Cc: Joe Perches
    Cc: Matthew Wilcox
    Cc: David Rientjes
    Cc: Dan Carpenter
    Cc: "Jason A . Donenfeld"
    Link: http://lkml.kernel.org/r/20200616154311.12314-3-longman@redhat.com
    Signed-off-by: Linus Torvalds

    Waiman Long
     

31 Jul, 2020

1 commit

  • Gives drivers the definitions needed to advertise support
    for S1G bands.

    Signed-off-by: Thomas Pedersen
    Link: https://lore.kernel.org/r/20200602062247.23212-1-thomas@adapt-ip.com
    Link: https://lore.kernel.org/r/20200731055636.795173-1-thomas@adapt-ip.com
    Signed-off-by: Johannes Berg

    Thomas Pedersen
     

05 Jun, 2020

1 commit

  • Lockdep reports that we may deadlock because we take the RTNL on
    the work struct, but flush it under RTNL. Clearly, it's correct.
    In practice, this can happen when doing rfkill on an active device.

    Fix this by moving the work struct to the wiphy (registered dev)
    layer, and iterate over all the wdevs inside there. This then
    means we need to track which one of them has work to do, so we
    don't update to the driver for all wdevs all the time.

    Also fix a locking bug I noticed while working on this - the
    registrations list is iterated as if it was an RCU list, but it
    isn't handle that way - and we need to lock now for the update
    flag anyway, so remove the RCU.

    Fixes: 6cd536fe62ef ("cfg80211: change internal management frame registration API")
    Reported-by: Markus Theil
    Reported-and-tested-by: Kenneth R. Crudup
    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20200604120420.b1dc540a7e26.I55dcca56bb5bdc5d7ad66a36a0b42afd7034d8be@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     

01 Jun, 2020

1 commit

  • xdp_umem.c had overlapping changes between the 64-bit math fix
    for the calculation of npgs and the removal of the zerocopy
    memory type which got rid of the chunk_size_nohdr member.

    The mlx5 Kconfig conflict is a case where we just take the
    net-next copy of the Kconfig entry dependency as it takes on
    the ESWITCH dependency by one level of indirection which is
    what the 'net' conflicting change is trying to ensure.

    Signed-off-by: David S. Miller

    David S. Miller
     

31 May, 2020

2 commits

  • On 6 GHz band, HE capabilities must be available for all of
    the interface types, otherwise we shouldn't use 6 GHz. Check
    this.

    Link: https://lore.kernel.org/r/20200528213443.5881cb3c8c4a.I583b54172f91f98d44af64a16c5826fe458cbb27@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • On the 6 GHz band, HE should be used, but without any direct HT/VHT
    capabilities, instead the HE 6 GHz band capabilities will capture
    the relevant information. Reject HT/VHT capabilities here.

    Link: https://lore.kernel.org/r/20200528213443.bfe89c35459a.Ibba5e066fa0087fd49d13cfee89d196ea0c68ae2@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     

25 May, 2020

1 commit

  • Removing the "if (IS_ERR(dir)) dir = NULL;" check only works
    if we adjust the remaining code to not rely on it being NULL.
    Check IS_ERR_OR_NULL() before attempting to dereference it.

    I'm not actually entirely sure this fixes the syzbot crash as
    the kernel config indicates that they do have DEBUG_FS in the
    kernel, but this is what I found when looking there.

    Cc: stable@vger.kernel.org
    Fixes: d82574a8e5a4 ("cfg80211: no need to check return value of debugfs_create functions")
    Reported-by: syzbot+fd5332e429401bf42d18@syzkaller.appspotmail.com
    Reviewed-by: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20200525113816.fc4da3ec3d4b.Ica63a110679819eaa9fb3bc1b7437d96b1fd187d@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     

24 Apr, 2020

2 commits

  • This should be covered by the next MHz, make sure that the
    numbers are always normalized.

    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20200424120103.12b91ecf75f9.I4bf499d58404283bbfacb517d614a816763bccf2@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Almost all drivers below cfg80211 get the API wrong (except for
    cfg80211) and are unable to cope with multiple registrations for
    the same frame type, which is valid due to the match filter.
    This seems to indicate the API is wrong, and we should maintain
    the full information in cfg80211 instead of the drivers.

    Change the API to no longer inform the driver about individual
    registrations and unregistrations, but rather every time about
    the entire state of the entire wiphy and single wdev, whenever
    it may have changed. This also simplifies the code in cfg80211
    as it no longer has to track exactly what was unregistered and
    can free things immediately.

    Signed-off-by: Johannes Berg
    Acked-by: Arend van Spriel
    Reviewed-by: Sergey Matyukevich
    Link: https://lore.kernel.org/r/20200417124300.f47f3828afc8.I7f81ef59c2c5a340d7075fb3c6d0e08e8aeffe07@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     

20 Mar, 2020

1 commit


13 Dec, 2019

1 commit

  • If wdev->wext.keys was initialized it didn't get reset to NULL on
    unregister (and it doesn't get set in cfg80211_init_wdev either), but
    wdev is reused if unregister was triggered through
    cfg80211_switch_netns.

    The next unregister (for whatever reason) will try to free
    wdev->wext.keys again.

    Signed-off-by: Stefan Bühler
    Link: https://lore.kernel.org/r/20191126100543.782023-1-stefan.buehler@tik.uni-stuttgart.de
    Signed-off-by: Johannes Berg

    Stefan Bühler
     

11 Sep, 2019

1 commit

  • When the RFKILL subsystem isn't available, then rfkill_blocked()
    always returns false. In the case of hardware rfkill this will
    be wrong though, as if the hardware reported being killed then
    it cannot operate any longer.

    Since we only ever call the rfkill_sync work in this case, just
    rename it to rfkill_block and always pass "true" for the blocked
    parameter, rather than passing rfkill_blocked().

    We rely on the underlying driver to still reject any new attempt
    to bring up the device by itself.

    Signed-off-by: Johannes Berg
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20190830112451.21655-2-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Johannes Berg
     

07 Aug, 2019

1 commit


26 Jul, 2019

2 commits

  • Commit 33d915d9e8ce ("{nl,mac}80211: allow 4addr AP operation on
    crypto controlled devices") has introduced a change which allows
    4addr operation on crypto controlled devices (ex: ath10k). This
    change has inadvertently impacted the interface combinations logic
    on such devices.

    General rule is that software interfaces like AP/VLAN should not be
    listed under supported interface combinations and should not be
    considered during validation of these combinations; because of the
    aforementioned change, AP/VLAN interfaces(if present) will be checked
    against interfaces supported by the device and blocks valid interface
    combinations.

    Consider a case where an AP and AP/VLAN are up and running; when a
    second AP device is brought up on the same physical device, this AP
    will be checked against the AP/VLAN interface (which will not be
    part of supported interface combinations of the device) and blocks
    second AP to come up.

    Add a new API cfg80211_iftype_allowed() to fix the problem, this
    API works for all devices with/without SW crypto control.

    Signed-off-by: Manikanta Pubbisetty
    Fixes: 33d915d9e8ce ("{nl,mac}80211: allow 4addr AP operation on crypto controlled devices")
    Link: https://lore.kernel.org/r/1563779690-9716-1-git-send-email-mpubbise@codeaurora.org
    Signed-off-by: Johannes Berg

    Manikanta Pubbisetty
     
  • When calling debugfs functions, there is no need to ever check the
    return value. The function can work or not, but the code logic should
    never do something different based on this.

    Signed-off-by: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20190703070142.GA29993@kroah.com
    Signed-off-by: Johannes Berg

    Greg Kroah-Hartman
     

18 Jun, 2019

1 commit


15 Jun, 2019

1 commit


14 Jun, 2019

2 commits

  • In wiphy_new_nm(), if an error occurs after dev_set_name() and
    device_initialize() have already been called, it's necessary to call
    put_device() (via wiphy_free()) to avoid a memory leak.

    Reported-by: syzbot+7fddca22578bc67c3fe4@syzkaller.appspotmail.com
    Fixes: 1f87f7d3a3b4 ("cfg80211: add rfkill support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Eric Biggers
    Signed-off-by: Johannes Berg

    Eric Biggers
     
  • Require that each vendor command give a policy of its sub-attributes
    in NL80211_ATTR_VENDOR_DATA, and then (stricly) check the contents,
    including the NLA_F_NESTED flag that we couldn't check on the outer
    layer because there we don't know yet.

    It is possible to use VENDOR_CMD_RAW_DATA for raw data, but then no
    nested data can be given (NLA_F_NESTED flag must be clear) and the
    data is just passed as is to the command.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

24 May, 2019

1 commit

  • As per the current design, in the case of sw crypto controlled devices,
    it is the device which advertises the support for AP/VLAN iftype based
    on it's ability to tranmsit packets encrypted in software
    (In VLAN functionality, group traffic generated for a specific
    VLAN group is always encrypted in software). Commit db3bdcb9c3ff
    ("mac80211: allow AP_VLAN operation on crypto controlled devices")
    has introduced this change.

    Since 4addr AP operation also uses AP/VLAN iftype, this conditional
    way of advertising AP/VLAN support has broken 4addr AP mode operation on
    crypto controlled devices which do not support VLAN functionality.

    In the case of ath10k driver, not all firmwares have support for VLAN
    functionality but all can support 4addr AP operation. Because AP/VLAN
    support is not advertised for these devices, 4addr AP operations are
    also blocked.

    Fix this by allowing 4addr operation on devices which do not support
    AP/VLAN iftype but can support 4addr AP operation (decision is based on
    the wiphy flag WIPHY_FLAG_4ADDR_AP).

    Cc: stable@vger.kernel.org
    Fixes: db3bdcb9c3ff ("mac80211: allow AP_VLAN operation on crypto controlled devices")
    Signed-off-by: Manikanta Pubbisetty
    Signed-off-by: Johannes Berg

    Manikanta Pubbisetty
     

21 May, 2019

1 commit

  • Add SPDX license identifiers to all files which:

    - Have no license information of any form

    - Have MODULE_LICENCE("GPL*") inside which was used in the initial
    scan/conversion to ignore the file

    These files fall under the project license, GPL v2 only. The resulting SPDX
    license identifier is:

    GPL-2.0-only

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

06 Feb, 2019

1 commit

  • When we destroy the interface we already hold the wdev->mtx
    while calling cfg80211_pmsr_wdev_down(), which assumes this
    isn't true and flushes the worker that takes the lock, thus
    leading to a deadlock.

    Fix this by refactoring the worker and calling its code in
    cfg80211_pmsr_wdev_down() directly.

    We still need to flush the work later to make sure it's not
    still running and will crash, but it will not do anything.

    Fixes: 9bb7e0f24e7e ("cfg80211: add peer measurement with FTM initiator API")
    Signed-off-by: Johannes Berg

    Johannes Berg
     

09 Nov, 2018

2 commits

  • When a wiphy changes its namespace, all interfaces are moved to the
    new namespace as well. The network interfaces are properly announced
    as leaving on the old and as appearing on the new namespace through
    RTM_NEWLINK/RTM_DELLINK. On nl80211, however, these events are missing
    for radios and their interfaces.

    Add netlink announcements through nl80211 when switching namespaces,
    so userspace can rely on these events to discover radios properly.

    Signed-off-by: Martin Willi
    Signed-off-by: Johannes Berg

    Martin Willi
     
  • Add a new "peer measurement" API, that can be used to measure
    certain things related to a peer. Right now, only implement
    FTM (flight time measurement) over it, but the idea is that
    it'll be extensible to also support measuring the necessary
    things to calculate e.g. angle-of-arrival for WiGig.

    The API is structured to have a generic list of peers and
    channels to measure with/on, and then for each of those a
    set of measurements (again, only FTM right now) to perform.

    Results are sent to the requesting socket, including a final
    complete message.

    Closing the controlling netlink socket will abort a running
    measurement.

    v3:
    - add a bit to report "final" for partial results
    - remove list keeping etc. and just unicast out the results
    to the requester (big code reduction ...)
    - also send complete message unicast, and as a result
    remove the multicast group
    - separate out struct cfg80211_pmsr_ftm_request_peer
    from struct cfg80211_pmsr_request_peer
    - document timeout == 0 if no timeout
    - disallow setting timeout nl80211 attribute to 0,
    must not include attribute for no timeout
    - make MAC address randomization optional
    - change num bursts exponent default to 0 (1 burst, rather
    rather than the old default of 15==don't care)

    v4:
    - clarify NL80211_ATTR_TIMEOUT documentation

    v5:
    - remove unnecessary nl80211 multicast/family changes
    - remove partial results bit/flag, final is sufficient
    - add max_bursts_exponent, max_ftms_per_burst to capability
    - rename "frames per burst" -> "FTMs per burst"

    v6:
    - rename cfg80211_pmsr_free_wdev() to cfg80211_pmsr_wdev_down()
    and call it in leave, so the device can't go down with any
    pending measurements

    v7:
    - wording fixes (Lior)
    - fix ftm.max_bursts_exponent to allow having the limit of 0 (Lior)

    v8:
    - copyright statements
    - minor coding style fixes
    - fix error path leak

    Signed-off-by: Johannes Berg

    Johannes Berg
     

02 Oct, 2018

4 commits


30 Jun, 2018

1 commit

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

    Small merge conflict in net/mac80211/scan.c, I preserved
    the kcalloc() conversion. -DaveM

    Johannes Berg says:

    ====================
    This round's updates:
    * finally some of the promised HE code, but it turns
    out to be small - but everything kept changing, so
    one part I did in the driver was >30 patches for
    what was ultimately <200 lines of code ... similar
    here for this code.
    * improved scan privacy support - can now specify scan
    flags for randomizing the sequence number as well as
    reducing the probe request element content
    * rfkill cleanups
    * a timekeeping cleanup from Arnd
    * various other cleanups
    ====================

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

    David S. Miller
     

15 Jun, 2018

2 commits

  • Add support for the HE in cfg80211 and also add userspace API to
    nl80211 to send rate information out, conforming with P802.11ax_D2.0.

    Signed-off-by: Liad Kaufman
    Signed-off-by: Johannes Berg
    Signed-off-by: Ilan Peer
    Signed-off-by: Ido Yariv
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Luca Coelho
     
  • Callers of cfg80211_unregister_wdev can free the wdev object
    immediately after this function returns. This may crash the kernel
    because this wdev object is still in use by other threads.
    Add synchronize_rcu() after list_del_rcu to make sure wdev object can
    be safely freed.

    Signed-off-by: Dedy Lansky
    Signed-off-by: Johannes Berg

    Dedy Lansky
     

23 May, 2018

1 commit

  • Use NL80211_CMD_UPDATE_CONNECT_PARAMS to update new ERP information,
    Association IEs and the Authentication type to driver / firmware which
    will be used in subsequent roamings.

    Signed-off-by: Vidyullatha Kanchanapally
    [arend: extended fils-sk kernel doc and added check in wiphy_register()]
    Reviewed-by: Jithu Jance
    Reviewed-by: Eylon Pedinovsky
    Signed-off-by: Arend van Spriel
    Signed-off-by: Johannes Berg

    Vidyullatha Kanchanapally
     

19 Apr, 2018

1 commit

  • There's currently no limit on wiphy names, other than netlink
    message size and memory limitations, but that causes issues when,
    for example, the wiphy name is used in a uevent, e.g. in rfkill
    where we use the same name for the rfkill instance, and then the
    buffer there is "only" 2k for the environment variables.

    This was reported by syzkaller, which used a 4k name.

    Limit the name to something reasonable, I randomly picked 128.

    Reported-by: syzbot+230d9e642a85d3fec29c@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg

    Johannes Berg
     

15 Jan, 2018

1 commit

  • syzbot reported a warning from rfkill_alloc(), and after a while
    I think that the reason is that it was doing fault injection and
    the dev_set_name() failed, leaving the name NULL, and we didn't
    check the return value and got to rfkill_alloc() with a NULL name.
    Since we really don't want a NULL name, we ought to check the
    return value.

    Fixes: fb28ad35906a ("net: struct device - replace bus_id with dev_name(), dev_set_name()")
    Reported-by: syzbot+1ddfb3357e1d7bb5b5d3@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg

    Johannes Berg
     

11 Oct, 2017

1 commit

  • As the current regulatory database is only about 4k big, and already
    difficult to extend, we decided that overall it would be better to
    get rid of the complications with CRDA and load the database into the
    kernel directly, but in a new format that is extensible.

    The new file format can be extended since it carries a length field
    on all the structs that need to be extensible.

    In order to be able to request firmware when the module initializes,
    move cfg80211 from subsys_initcall() to the later fs_initcall(); the
    firmware loader is at the same level but linked earlier, so it can
    be called from there. Otherwise, when both the firmware loader and
    cfg80211 are built-in, the request will crash the kernel. We also
    need to be before device_initcall() so that cfg80211 is available
    for devices when they initialize.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

13 Jun, 2017

1 commit

  • Add API for setting the PMK to the driver. For FT support, allow
    setting also the PMK-R0 Name.

    This can be used by drivers that support 4-Way handshake offload
    while IEEE802.1X authentication is managed by upper layers.

    Signed-off-by: Avraham Stern
    Signed-off-by: Johannes Berg
    [arend.vanspriel@broadcom.com: add WANT_1X_4WAY_HS attribute]
    Signed-off-by: Arend van Spriel
    [reword NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X docs a bit to
    say that the device may require it]
    Signed-off-by: Johannes Berg

    Avraham Stern
     

28 Apr, 2017

1 commit


27 Apr, 2017

1 commit

  • This patch implements the idea to have multiple scheduled scan requests
    running concurrently. It mainly illustrates how to deal with the incoming
    request from user-space in terms of backward compatibility. In order to
    use multiple scheduled scans user-space needs to provide a flag attribute
    NL80211_ATTR_SCHED_SCAN_MULTI to indicate support. If not the request is
    treated as a legacy scan.

    Drivers currently supporting scheduled scan are now indicating they support
    a single scheduled scan request. This obsoletes WIPHY_FLAG_SUPPORTS_SCHED_SCAN.

    Reviewed-by: Hante Meuleman
    Reviewed-by: Pieter-Paul Giesberts
    Reviewed-by: Franky Lin
    Signed-off-by: Arend van Spriel
    [clean up netlink destroy path to avoid allocations, code cleanups]
    Signed-off-by: Johannes Berg

    Arend Van Spriel