Commit Graph

358 Commits

Author SHA1 Message Date
Jose Ignacio Tornos Martinez 284b2b6817 wifi: cfg80211: check radio iface combination for multi radio per wiphy
JIRA: https://issues.redhat.com/browse/RHEL-73817

commit bd9813d13be439851a7ff3e6372e53caa6e387a6
Author: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Date:   Tue Sep 17 19:32:39 2024 +0530

    wifi: cfg80211: check radio iface combination for multi radio per wiphy
    
    Currently, wiphy_verify_combinations() fails for the multi-radio per wiphy
    due to the condition check on new global interface combination that DFS
    only works on one channel. In a multi-radio scenario, new global interface
    combination encompasses the capabilities of all radio combinations, so it
    supports more than one channel with DFS. For multi-radio per wiphy,
    interface combination verification needs to be performed for radio specific
    interface combinations. This is necessary as the new global interface
    combination combines the capabilities of all radio combinations.
    
    Fixes: a01b1e9f9955 ("wifi: mac80211: add support for DFS with multiple radios")
    Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
    Link: https://patch.msgid.link/20240917140239.886083-1-quic_periyasa@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2025-01-15 17:26:22 +01:00
Jose Ignacio Tornos Martinez ced0b41a65 wifi: cfg80211: clear wdev->cqm_config pointer on free
JIRA: https://issues.redhat.com/browse/RHEL-67113
JIRA: https://issues.redhat.com/browse/RHEL-66824
CVE: CVE-2024-50235

commit d5fee261dfd9e17b08b1df8471ac5d5736070917
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Oct 22 16:17:42 2024 +0200

    wifi: cfg80211: clear wdev->cqm_config pointer on free
    
    When we free wdev->cqm_config when unregistering, we also
    need to clear out the pointer since the same wdev/netdev
    may get re-registered in another network namespace, then
    destroyed later, running this code again, which results in
    a double-free.
    
    Reported-by: syzbot+36218cddfd84b5cc263e@syzkaller.appspotmail.com
    Fixes: 37c20b2effe9 ("wifi: cfg80211: fix cqm_config access race")
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20241022161742.7c34b2037726.I121b9cdb7eb180802eafc90b493522950d57ee18@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-11-22 10:58:20 +01:00
Jose Ignacio Tornos Martinez 3ac5e7ed07 wifi: cfg80211: Add wiphy_delayed_work_pending()
JIRA: https://issues.redhat.com/browse/RHEL-67113

commit 68d0021fe7231eec0fb84cd110cf62a6e782b72d
Author: Remi Pommarel <repk@triplefau.lt>
Date:   Tue Sep 24 21:28:04 2024 +0200

    wifi: cfg80211: Add wiphy_delayed_work_pending()
    
    Add wiphy_delayed_work_pending() to check if any delayed work timer is
    pending, that can be used to be sure that wiphy_delayed_work_queue()
    won't postpone an already pending delayed work.
    
    Signed-off-by: Remi Pommarel <repk@triplefau.lt>
    Link: https://patch.msgid.link/20240924192805.13859-2-repk@triplefau.lt
    [fix return value kernel-doc]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-11-22 10:58:18 +01:00
Rado Vrbovsky c1d10d813b Merge: Wireless core and drivers rebase to v6.11
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5415

JIRA: https://issues.redhat.com/browse/RHEL-50013  

Tested: basic testing with several supported WiFi cards (Intel, Qualcomm, Mediatek and Realtek).

Wireless core and drivers update to v6.11.

Upstream status: linux.git

Later fixes to be included in next rebases:  
Omitted-fix: 0129e5ff2842 wifi: rtw88: 8703b: Fix reported RX band width  
Omitted-fix: 177b49dbf9c1 wifi: ath11k: use work queue to process beacon tx event  
Omitted-fix: 9b8d932053b8 wifi: mt76: mt7603: fix mixed declarations and code  
Omitted-fix: ded1a6d9e13a wifi: mt76: mt7996: fix handling mbss enable/disable  
Omitted-fix: 56310ddb50b1 wifi: rtw89: remove unused C2H event ID RTW89_MAC_C2H_FUNC_READ_WOW_CAM to prevent out-of-bounds reading  
Omitted-fix: d9dd3ac77cf7 wifi: rtw89: wow: fix wait condition for AOAC report request  
Omitted-fix: 76364f3edfde wifi: iwlwifi: mvm: allow ESR when we the ROC expires  
Omitted-fix: a949075d4bbf wifi: iwlwifi: mvm: set the cipher for secured NDP ranging  
Omitted-fix: a7bc66fe8093 bus: mhi: host: pci_generic: Update EDL firmware path for Foxconn modems  
Omitted-fix: bd9813d13be4 wifi: cfg80211: check radio iface combination for multi radio per wiphy  
Omitted-fix: 7c24c5bdf489 wifi: mac80211_hwsim: correct MODULE_PARM_DESC of multi_radio  
Omitted-fix: 45ae0e8cf8c7 wifi: rtw89: 8852c: support firmware format up to v1  
Omitted-fix: f403fed7f98e wifi: mac80211: remove label usage in ieee80211_start_radar_detection()  
Omitted-fix: f4bb650cfab4 wifi: trace: unlink rdev_end_cac trace event from wiphy_netdev_evt class  
Omitted-fix: 62c16f219a73 wifi: cfg80211: move DFS related members to links[] in wireless_dev  
Omitted-fix: 81f67d60ebf2 wifi: cfg80211: handle DFS per link  
Omitted-fix: d74380ee99b5 wifi: mac80211: handle DFS per link  
Omitted-fix: 0b7798232eee wifi: cfg80211/mac80211: use proper link ID for DFS  
Omitted-fix: bca8bc0399ac wifi: mac80211: handle ieee80211_radar_detected() for MLO  
Omitted-fix: 53d7c99719e2 wifi: ath11k: fix RCU documentation in ath11k_mac_op_ipv6_changed()  

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>

Approved-by: Herton R. Krzesinski <herton@redhat.com>
Approved-by: Desnes Nunes <desnesn@redhat.com>
Approved-by: Kamal Heib <kheib@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2024-11-15 13:27:52 +00:00
Jose Ignacio Tornos Martinez 9cf9684715 wifi: nl80211: clean up coalescing rule handling
JIRA: https://issues.redhat.com/browse/RHEL-50013

commit 8526f8c877baf3f9e678b31fd7d1066b776775cc
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu May 23 12:02:13 2024 +0200

    wifi: nl80211: clean up coalescing rule handling
    
    There's no need to allocate a tiny struct and then
    an array again, just allocate the two together and
    use __counted_by(). Also unify the freeing.
    
    Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20240523120213.48a40cfb96f9.Ia02bf8f8fefbf533c64c5fa26175848d4a3a7899@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-10-29 08:17:55 +01:00
Jose Ignacio Tornos Martinez ae7a83cb02 wifi: cfg80211: add tracing for wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-50013

commit eb745c7c854e200d7fd6ba0944691a1aaf882d4d
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon May 6 21:00:03 2024 +0200

    wifi: cfg80211: add tracing for wiphy work
    
    Add trace events to trace when wiphy works are queued (or
    delayed ones scheduled), and other APIs are called. Also
    add an event when the worker starts, before acquiring the
    mutex, to be able to see potential delays due to locking.
    
    Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
    Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
    Link: https://msgid.link/20240506210002.bf1840a1d22d.I4abba048c1c4017345640219cf1384a0b2288dd3@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-10-29 08:17:42 +01:00
Jose Ignacio Tornos Martinez b9089d692e wifi: cfg80211: fully move wiphy work to unbound workqueue
JIRA: https://issues.redhat.com/browse/RHEL-50013

commit e296c95eac655008d5a709b8cf54d0018da1c916
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed May 22 12:41:25 2024 +0200

    wifi: cfg80211: fully move wiphy work to unbound workqueue
    
    Previously I had moved the wiphy work to the unbound
    system workqueue, but missed that when it restarts and
    during resume it was still using the normal system
    workqueue. Fix that.
    
    Fixes: 91d20ab9d9ca ("wifi: cfg80211: use system_unbound_wq for wiphy work")
    Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
    Link: https://msgid.link/20240522124126.7ca959f2cbd3.I3e2a71ef445d167b84000ccf934ea245aef8d395@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-10-29 08:17:24 +01:00
Michal Schmidt a672f9b810 netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local
JIRA: https://issues.redhat.com/browse/RHEL-59091

commit 05c1280a2bcfca187fe7fa90bb240602cf54af0a
Author: Alexander Lobakin <aleksander.lobakin@intel.com>
Date:   Thu Aug 29 14:33:38 2024 +0200

    netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local

    "Interface can't change network namespaces" is rather an attribute,
    not a feature, and it can't be changed via Ethtool.
    Make it a "cold" private flag instead of a netdev_feature and free
    one more bit.

    Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Conflicts:
	drivers/net/amt.c
	drivers/net/ethernet/adi/adin1110.c

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
2024-10-03 17:59:51 +02:00
Jose Ignacio Tornos Martinez a6c69a2542 wifi: cfg80211: fix wiphy delayed work queueing
JIRA: https://issues.redhat.com/browse/RHEL-28754

commit b743287d7a0007493f5cada34ed2085d475050b4
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Jan 25 09:51:09 2024 +0100

    wifi: cfg80211: fix wiphy delayed work queueing
    
    When a wiphy work is queued with timer, and then again
    without a delay, it's started immediately but *also*
    started again after the timer expires. This can lead,
    for example, to warnings in mac80211's offchannel code
    as reported by Jouni. Running the same work twice isn't
    expected, of course. Fix this by deleting the timer at
    this point, when queuing immediately due to delay=0.
    
    Cc: stable@vger.kernel.org
    Reported-by: Jouni Malinen <j@w1.fi>
    Fixes: a3ee4dc84c4e ("wifi: cfg80211: add a work abstraction with special semantics")
    Link: https://msgid.link/20240125095108.2feb0eaaa446.I4617f3210ed0e7f252290d5970dac6a876aa595b@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-03-18 17:58:15 +01:00
Jose Ignacio Tornos Martinez fcbade059c wifi: cfg80211: hold wiphy mutex for send_interface
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 103317670e6bf2542309db28d52444a83d84ed28
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Nov 15 13:06:16 2023 +0100

    wifi: cfg80211: hold wiphy mutex for send_interface
    
    Given all the locking rework in mac80211, we pretty much
    need to get into the driver with the wiphy mutex held in
    all callbacks. This is already mostly the case, but as
    Johan reported, in the get_txpower it may not be true.
    
    Lock the wiphy mutex around nl80211_send_iface(), then
    is also around callers of nl80211_notify_iface(). This
    is easy to do, fixes the problem, and aligns the locking
    between various calls to it in different parts of the
    code of cfg80211.
    
    Fixes: 0e8185ce1dde ("wifi: mac80211: check wiphy mutex in ops")
    Reported-by: Johan Hovold <johan@kernel.org>
    Closes: https://lore.kernel.org/r/ZVOXX6qg4vXEx8dX@hovoldconsulting.com
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:29:58 +01:00
Jose Ignacio Tornos Martinez cd14530a80 wifi: cfg80211: lock wiphy mutex for rfkill poll
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 8e2f6f2366219b3304b227bdd2f04b64c92e3e12
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Nov 8 13:41:25 2023 +0100

    wifi: cfg80211: lock wiphy mutex for rfkill poll
    
    We want to guarantee the mutex is held for pretty much
    all operations, so ensure that here as well.
    
    Reported-by: syzbot+7e59a5bfc7a897247e18@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:29:58 +01:00
Jose Ignacio Tornos Martinez 1eae9bbf76 wifi: cfg80211: annotate iftype_data pointer with sparse
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit e8c1841278a78362f7034f3de415096ddb19f097
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 28 09:54:39 2023 +0200

    wifi: cfg80211: annotate iftype_data pointer with sparse
    
    There were are a number of cases in mac80211 and iwlwifi (at
    least) that used the sband->iftype_data pointer directly,
    instead of using the accessors to find the right array entry
    to use.
    
    Make sparse warn when such a thing is done.
    
    To not have a lot of casts, add two helper functions/macros
    
     - ieee80211_set_sband_iftype_data()
     - for_each_sband_iftype_data()
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:54 +01:00
Jose Ignacio Tornos Martinez 9735b89fb4 wifi: cfg80211: remove wdev mutex
JIRA: https://issues.redhat.com/browse/RHEL-19746

Conflicts:
  - net/wireless/nl80211.c
    this commit was developed in a parallel branch and there were conflicts
    that were resolved when it merged (merge commit 7d6904bf26b96).

commit 076fc8775dafe995e94c106bb732bf2d42dedcea
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Aug 29 12:18:56 2023 +0200

    wifi: cfg80211: remove wdev mutex
    
    Since we're now protecting everything with the wiphy mutex
    (and were really using it for almost everything before),
    there's no longer any real reason to have a separate wdev
    mutex. It may feel better, but really has no value.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:54 +01:00
Jose Ignacio Tornos Martinez 63be7c3d15 wifi: cfg80211: add flush functions for wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 56cfb8ce1f7f6c4e5ca571a2ec0880e131cd0311
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 28 13:59:33 2023 +0200

    wifi: cfg80211: add flush functions for wiphy work
    
    There may be sometimes reasons to actually run the work
    if it's pending, add flush functions for both regular and
    delayed wiphy work that will do this.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:48 +01:00
Jose Ignacio Tornos Martinez bb272a8153 wifi: cfg80211: check RTNL when iterating devices
JIRA: https://issues.redhat.com/browse/RHEL-19746

commit 7483a2147aebea537e1447489109eeb5e771aff5
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Aug 28 13:59:32 2023 +0200

    wifi: cfg80211: check RTNL when iterating devices
    
    Add a new "for_each_rdev()" macro and check that we
    hold the RTNL when calling it.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2024-02-01 15:28:48 +01:00
Jose Ignacio Tornos Martinez 5be3ff126f wifi: cfg80211: use system_unbound_wq for wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 91d20ab9d9ca035527af503d00e1e30d6c375f2a
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Oct 9 10:18:01 2023 +0200

    wifi: cfg80211: use system_unbound_wq for wiphy work
    
    Since wiphy work items can run pretty much arbitrary
    code in the stack/driver, it can take longer to run
    all of this, so we shouldn't be using system_wq via
    schedule_work(). Also, we lock the wiphy (which is
    the reason this exists), so use system_unbound_wq.
    
    Reported-and-tested-by: Kalle Valo <kvalo@kernel.org>
    Fixes: a3ee4dc84c4e ("wifi: cfg80211: add a work abstraction with special semantics")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:02:38 +01:00
Jose Ignacio Tornos Martinez 4613fd29be wifi: cfg80211: fix cqm_config access race
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 37c20b2effe987b806c8de6d12978e4ffeff026f
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Aug 16 15:38:04 2023 +0200

    wifi: cfg80211: fix cqm_config access race
    
    Max Schulze reports crashes with brcmfmac. The reason seems
    to be a race between userspace removing the CQM config and
    the driver calling cfg80211_cqm_rssi_notify(), where if the
    data is freed while cfg80211_cqm_rssi_notify() runs it will
    crash since it assumes wdev->cqm_config is set. This can't
    be fixed with a simple non-NULL check since there's nothing
    we can do for locking easily, so use RCU instead to protect
    the pointer, but that requires pulling the updates out into
    an asynchronous worker so they can sleep and call back into
    the driver.
    
    Since we need to change the free anyway, also change it to
    go back to the old settings if changing the settings fails.
    
    Reported-and-tested-by: Max Schulze <max.schulze@online.de>
    Closes: https://lore.kernel.org/r/ac96309a-8d8d-4435-36e6-6d152eb31876@online.de
    Fixes: 4a4b816950 ("cfg80211: Accept multiple RSSI thresholds for CQM")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:02:36 +01:00
Jose Ignacio Tornos Martinez 2f3cf9492a wifi: cfg80211: fix regulatory disconnect with OCB/NAN
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit e8c2af660ba0790afd14d5cbc2fd05c6dc85e207
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Fri Jun 16 22:28:45 2023 +0200

    wifi: cfg80211: fix regulatory disconnect with OCB/NAN
    
    Since regulatory disconnect was added, OCB and NAN interface
    types were added, which made it completely unusable for any
    driver that allowed OCB/NAN. Add OCB/NAN (though NAN doesn't
    do anything, we don't have any info) and also remove all the
    logic that opts out, so it won't be broken again if/when new
    interface types are added.
    
    Fixes: 6e0bd6c35b ("cfg80211: 802.11p OCB mode handling")
    Fixes: cb3b7d8765 ("cfg80211: add start / stop NAN commands")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Link: https://lore.kernel.org/r/20230616222844.2794d1625a26.I8e78a3789a29e6149447b3139df724a6f1b46fc3@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:40 +01:00
Jose Ignacio Tornos Martinez fb979456ec wifi: cfg80211: move scan done work to wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit fe0af9fe54d0ff53aa49eef390c8962355b274e2
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:33 2023 +0200

    wifi: cfg80211: move scan done work to wiphy work
    
    Move the scan done work to the new wiphy work to
    simplify the code a bit.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:20 +01:00
Jose Ignacio Tornos Martinez 7f0b76645e wifi: cfg80211: move sched scan stop to wiphy work
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit c88d7178229b7b9482ab4cc0b781aef0f20c3dfb
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:32 2023 +0200

    wifi: cfg80211: move sched scan stop to wiphy work
    
    This work can now trivially be converted, it behaves
    identical either way.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:20 +01:00
Jose Ignacio Tornos Martinez 2959d9b1cf wifi: cfg80211: add a work abstraction with special semantics
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit a3ee4dc84c4e9d14cb34dad095fd678127aca5b6
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:25 2023 +0200

    wifi: cfg80211: add a work abstraction with special semantics
    
    Add a work abstraction at the cfg80211 level that will always
    hold the wiphy_lock() for any work executed and therefore also
    can be canceled safely (without waiting) while holding that.
    This improves on what we do now as with the new wiphy works we
    don't have to worry about locking while cancelling them safely.
    
    Also, don't let such works run while the device is suspended,
    since they'll likely need to interact with the device. Flush
    them before suspend though.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:19 +01:00
Jose Ignacio Tornos Martinez 14e1ce9b27 wifi: cfg80211: hold wiphy lock when sending wiphy
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 4d45145ba6e2e1c0eba4ebda7d6273319191f4e8
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:24 2023 +0200

    wifi: cfg80211: hold wiphy lock when sending wiphy
    
    Sending the wiphy out might cause calls to the driver,
    notably get_txq_stats() and get_antenna(). These aren't
    very important, since the normally have their own locks
    and/or just send out static data, but if the contract
    should be that the wiphy lock is always held, these are
    also affected. Fix that.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:19 +01:00
Jose Ignacio Tornos Martinez 3af98cc28d wifi: cfg80211: move wowlan disable under locks
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit a993df0f9143e63eca38c96a30daf08db99a98a3
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:22 2023 +0200

    wifi: cfg80211: move wowlan disable under locks
    
    This is a driver callback, and the driver should be able
    to assume that it's called with the wiphy lock held. Move
    the call up so that's true, it has no other effect since
    the device is already unregistering and we cannot reach
    this function through other paths.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:18 +01:00
Jose Ignacio Tornos Martinez fe70eb3906 wifi: cfg80211: hold wiphy lock in pmsr work
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 0dcb84ede5b0a99fc125df2f82ca1f539d41446d
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:21 2023 +0200

    wifi: cfg80211: hold wiphy lock in pmsr work
    
    Most code paths in cfg80211 already hold the wiphy lock,
    mostly by virtue of being called from nl80211, so make
    the pmsr cleanup worker also hold it, aligning the
    locking promises between different parts of cfg80211.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:18 +01:00
Jose Ignacio Tornos Martinez fff9e866f9 wifi: cfg80211: hold wiphy lock in auto-disconnect
JIRA: https://issues.redhat.com/browse/RHEL-2907

commit e9da6df7492a981b071bafd169fb4c35b45f5ebf
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:49:20 2023 +0200

    wifi: cfg80211: hold wiphy lock in auto-disconnect
    
    Most code paths in cfg80211 already hold the wiphy lock,
    mostly by virtue of being called from nl80211, so make
    the auto-disconnect worker also hold it, aligning the
    locking promises between different parts of cfg80211.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-11-27 15:01:18 +01:00
Íñigo Huguet 7271def69f wifi: cfg80211: fix locking in sched scan stop work
Bugzilla: https://bugzilla.redhat.com/2196821

commit 3e54ed8247c94c8bdf370bd872bd9dfe72b1b12b
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 6 14:34:47 2023 +0200

    wifi: cfg80211: fix locking in sched scan stop work
    
    This should use wiphy_lock() now instead of acquiring the
    RTNL, since cfg80211_stop_sched_scan_req() now needs that.
    
    Fixes: a05829a722 ("cfg80211: avoid holding the RTNL when calling the driver")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2023-07-26 13:16:35 +02:00
Jose Ignacio Tornos Martinez 03a7909db8 Revert "wifi: mark the support for WiFi on aarch64 architecture as tech preview"
Bugzilla: https://bugzilla.redhat.com/2208365

Upstream status: RHEL-only

This reverts commit 4b86fd2409 because now all the representetaive wifi
cards have been successfully tested with arm64 platforms and have the same
behavior as with intel platforms.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-07-13 14:19:28 +02:00
Jose Ignacio Tornos Martinez 4b86fd2409 wifi: mark the support for WiFi on aarch64 architecture as tech preview
Upstream-Status: RHEL only
Bugzilla: http://bugzilla.redhat.com/2143728

Until further tested, the support for WiFi on aarch64 architecture is marked
as tech preview, because the number of tested wifi cards and machines are not
too much, although the tested equipment could be representative:
- arm64 server (GIGABYTE R152-P31-00) with AX200 wifi card
- NVIDIA Orin with RTL8822CE 802.11ac

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-05-03 15:17:53 +02:00
Jose Ignacio Tornos Martinez 35e5d5a945 wifi: cfg80211/mac80211: check EHT capability size correctly
Bugzilla: https://bugzilla.redhat.com/2136124

commit ea5cba269fb1fe22b84f4d01bb3d56320e6ffa3e
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Aug 16 11:26:23 2022 +0200

    wifi: cfg80211/mac80211: check EHT capability size correctly
    
    For AP/non-AP the EHT MCS/NSS subfield size differs, the
    4-octet subfield is only used for 20 MHz-only non-AP STA.
    Pass an argument around everywhere to be able to parse it
    properly.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
2023-01-27 13:40:01 +01:00
Íñigo Huguet a449340399 wifi: cfg80211: clean up links appropriately
Bugzilla: https://bugzilla.redhat.com/2136122

commit cdf0a0a80c841cfede6926d417a8756ea4c52d26
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Wed Jul 6 09:57:42 2022 +0200

    wifi: cfg80211: clean up links appropriately
    
    This was missing earlier, we need to remove links when
    interfaces are being destroyed, and we also need to
    stop (AP) operations when a link is being destroyed.
    Address these issues to remove many warnings that will
    otherwise appear in mac80211.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:57:32 +01:00
Íñigo Huguet 66056c56ee wifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings
Bugzilla: https://bugzilla.redhat.com/2136122

commit ecad3b0b99bff7247a11f8c7cb19ac9b0cb28b09
Author: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Date:   Mon May 23 18:55:58 2022 +0530

    wifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings
    
    Increase akm_suites array size in struct cfg80211_crypto_settings to 10
    and advertise the capability to userspace. This allows userspace to send
    more than two AKMs to driver in netlink commands such as
    NL80211_CMD_CONNECT.
    
    This capability is needed for implementing WPA3-Personal transition mode
    correctly with any driver that handles roaming internally. Currently,
    the possible AKMs for multi-AKM connect can include PSK, PSK-SHA-256,
    SAE, FT-PSK and FT-SAE. Since the count is already 5, increasing
    the akm_suites array size to 10 should be reasonable for future
    usecases.
    
    Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
    Link: https://lore.kernel.org/r/1653312358-12321-1-git-send-email-quic_vjakkam@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:57:12 +01:00
Íñigo Huguet 7cc314edf6 wifi: cfg80211: do some rework towards MLO link APIs
Bugzilla: https://bugzilla.redhat.com/2136122

Conflicts: removed chunk of unsupported driver rtl8723bs

commit 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Thu Apr 14 16:50:57 2022 +0200

    wifi: cfg80211: do some rework towards MLO link APIs
    
    In order to support multi-link operation with multiple links,
    start adding some APIs. The notable addition here is to have
    the link ID in a new nl80211 attribute, that will be used to
    differentiate the links in many nl80211 operations.
    
    So far, this patch adds the netlink NL80211_ATTR_MLO_LINK_ID
    attribute (as well as the NL80211_ATTR_MLO_LINKS attribute)
    and plugs it through the system in some places, checking the
    validity etc. along with other infrastructure needed for it.
    
    For now, I've decided to include only the over-the-air link
    ID in the API. I know we discussed that we eventually need to
    have to have other ways of identifying a link, but for local
    AP mode and auth/assoc commands as well as set_key etc. we'll
    use the OTA ID.
    
    Also included in this patch is some refactoring of the data
    structures in struct wireless_dev, splitting for the first
    time the data into type dependent pieces, to make reasoning
    about these things easier.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-11-28 12:56:58 +01:00
Íñigo Huguet 37f8fee954 cfg80211: fix race in netlink owner interface destruction
Bugzilla: https://bugzilla.redhat.com/2059999

commit f0a6fd1527067da537e9c48390237488719948ed
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Feb 1 14:09:51 2022 +0100

    cfg80211: fix race in netlink owner interface destruction
    
    My previous fix here to fix the deadlock left a race where
    the exact same deadlock (see the original commit referenced
    below) can still happen if cfg80211_destroy_ifaces() already
    runs while nl80211_netlink_notify() is still marking some
    interfaces as nl_owner_dead.
    
    The race happens because we have two loops here - first we
    dev_close() all the netdevs, and then we destroy them. If we
    also have two netdevs (first one need only be a wdev though)
    then we can find one during the first iteration, close it,
    and go to the second iteration -- but then find two, and try
    to destroy also the one we didn't close yet.
    
    Fix this by only iterating once.
    
    Reported-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Fixes: ea6b2098dd ("cfg80211: fix locking in netlink owner interface destruction")
    Tested-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Link: https://lore.kernel.org/r/20220201130951.22093-1-johannes@sipsolutions.net
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:50:07 +02:00
Íñigo Huguet 8c58222fe3 cfg80211: Enable regulatory enforcement checks for drivers supporting mesh iface
Bugzilla: https://bugzilla.redhat.com/2059999

Conflicts: context conflict due to commit from other branch, solved on merge upstream
  e08ebd6d7b90 cfg80211: Acquire wiphy mutex on regulatory work

commit 701fdfe348f7e5c9fe71caa3558d63dbb4bc4b81
Author: Sriram R <quic_srirrama@quicinc.com>
Date:   Thu Dec 2 07:08:40 2021 +0530

    cfg80211: Enable regulatory enforcement checks for drivers supporting mesh iface
    
    Currently cfg80211 checks for invalid channels whenever there is a
    regulatory update and stops the active interfaces if it is operating on
    an unsupported channel in the new regulatory domain.
    
    This is done based on a regulatory flag REGULATORY_IGNORE_STALE_KICKOFF
    set during wiphy registration which disables this enforcement when
    unsupported interface modes are supported by driver.
    
    Add support to enable this enforcement when Mesh Point interface type
    is advertised by drivers.
    
    Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
    Link: https://lore.kernel.org/r/1638409120-28997-1-git-send-email-quic_srirrama@quicinc.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:56 +02:00
Íñigo Huguet f3e7c91110 cfg80211: rename offchannel_chain structs to background_chain to avoid confusion with ETSI standard
Bugzilla: https://bugzilla.redhat.com/2059999

commit a95bfb876fa87e2d0fa718ee61a8030ddf162d2b
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Mon Nov 29 14:11:24 2021 +0100

    cfg80211: rename offchannel_chain structs to background_chain to avoid confusion with ETSI standard
    
    ETSI standard defines "Offchannel CAC" as:
    "Off-Channel CAC is performed by a number of non-continuous checks
    spread over a period in time. This period, which is required to
    determine the presence of radar signals, is defined as the Off-Channel
    CAC Time..
    Minimum Off-Channel CAC Time 6 minutes and Maximum Off-Channel CAC Time
    4 hours..".
    mac80211 implementation refers to a dedicated hw chain used for continuous
    radar monitoring. Rename offchannel_* references to background_* in
    order to avoid confusion with ETSI standard.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://lore.kernel.org/r/4204cc1d648d76b44557981713231e030a3bd991.1638190762.git.lorenzo@kernel.org
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:55 +02:00
Íñigo Huguet a2027f28a4 cfg80211: move offchan_cac_event to a dedicated work
Bugzilla: https://bugzilla.redhat.com/2059999

commit 1507b153198137dfa9cb4bec7c5dee07089ec3af
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Wed Oct 27 11:03:42 2021 +0200

    cfg80211: move offchan_cac_event to a dedicated work
    
    In order to make cfg80211_offchan_cac_abort() (renamed from
    cfg80211_offchan_cac_event) callable in other contexts and
    without so much locking restrictions, make it trigger a new
    work instead of operating directly.
    
    Do some other renames while at it to clarify.
    
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://lore.kernel.org/r/6145c3d0f30400a568023f67981981d24c7c6133.1635325205.git.lorenzo@kernel.org
    [rewrite commit log]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:34 +02:00
Íñigo Huguet b16086a774 cfg80211: implement APIs for dedicated radar detection HW
Bugzilla: https://bugzilla.redhat.com/2059999

commit bc2dfc02836b1133d1bf4d22aa13d48ac98eabef
Author: Lorenzo Bianconi <lorenzo@kernel.org>
Date:   Sat Oct 23 11:10:50 2021 +0200

    cfg80211: implement APIs for dedicated radar detection HW
    
    If a dedicated (off-channel) radar detection hardware (chain)
    is available in the hardware/driver, allow this to be used by
    calling the NL80211_CMD_RADAR_DETECT command with a new flag
    attribute requesting off-channel radar detection is used.
    
    Offchannel CAC (channel availability check) avoids the CAC
    downtime when switching to a radar channel or when turning on
    the AP.
    
    Drivers advertise support for this using the new feature flag
    NL80211_EXT_FEATURE_RADAR_OFFCHAN.
    
    Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
    Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
    Link: https://lore.kernel.org/r/7468e291ef5d05d692c1738d25b8f778d8ea5c3f.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/1e60e60fef00e14401adae81c3d49f3e5f307537.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/85fa50f57fc3adb2934c8d9ca0be30394de6b7e8.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/4b6c08671ad59aae0ac46fc94c02f31b1610eb72.1634979655.git.lorenzo@kernel.org
    Link: https://lore.kernel.org/r/241849ccaf2c228873c6f8495bf87b19159ba458.1634979655.git.lorenzo@kernel.org
    [remove offchan_mutex, fix cfg80211_stop_offchan_radar_detection(),
     remove gfp_t argument, fix documentation, fix tracing]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-05-31 14:49:34 +02:00
Íñigo Huguet 961bc33e4d cfg80211: always free wiphy specific regdomain
Bugzilla: http://bugzilla.redhat.com/2043454

commit e53e9828a8d2c6545e01ff9711f1221f2fd199ce
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Sep 27 13:11:06 2021 +0200

    cfg80211: always free wiphy specific regdomain
    
    In the (somewhat unlikely) event that we allocate a wiphy, then
    add a regdomain to it, and then fail registration, we leak the
    regdomain. Fix this by just always freeing it at the end, in the
    normal cases we'll free (and NULL) it during wiphy_unregister().
    This happened when the wiphy settings were bad, and since they
    can be controlled by userspace with hwsim, syzbot was able to
    find this issue.
    
    Reported-by: syzbot+1638e7c770eef6b6c0d0@syzkaller.appspotmail.com
    Fixes: 3e0c3ff36c ("cfg80211: allow multiple driver regulatory_hints()")
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Link: https://lore.kernel.org/r/20210927131105.68b70cef4674.I4b9f0aa08c2af28555963b9fe3d34395bb72e0cc@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2022-02-21 11:40:11 +01:00
Íñigo Huguet cf7ff9a0d4 cfg80211: fix management registrations locking
Bugzilla: http://bugzilla.redhat.com/2033354

commit 09b1d5dc6ce1c9151777f6c4e128a59457704c97
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Mon Oct 25 13:31:12 2021 +0200

    cfg80211: fix management registrations locking
    
    The management registrations locking was broken, the list was
    locked for each wdev, but cfg80211_mgmt_registrations_update()
    iterated it without holding all the correct spinlocks, causing
    list corruption.
    
    Rather than trying to fix it with fine-grained locking, just
    move the lock to the wiphy/rdev (still need the list on each
    wdev), we already need to hold the wdev lock to change it, so
    there's no contention on the lock in any case. This trivially
    fixes the bug since we hold one wdev's lock already, and now
    will hold the lock that protects all lists.
    
    Cc: stable@vger.kernel.org
    Reported-by: Jouni Malinen <j@w1.fi>
    Fixes: 6cd536fe62 ("cfg80211: change internal management frame registration API")
    Link: https://lore.kernel.org/r/20211025133111.5cf733eab0f4.I7b0abb0494ab712f74e2efcd24bb31ac33f7eee9@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
2021-12-22 13:46:09 +01:00
Miri Korenblit 1b7b3ac8ff cfg80211: set custom regdomain after wiphy registration
We used to set regulatory info before the registration of
the device and then the regulatory info didn't get set, because
the device isn't registered so there isn't a device to set the
regulatory info for. So set the regulatory info after the device
registration.
Call reg_process_self_managed_hints() once again after the device
registration because it does nothing before it.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210618133832.c96eadcffe80.I86799c2c866b5610b4cf91115c21d8ceb525c5aa@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-06-23 13:05:09 +02:00
Emmanuel Grumbach 358ae88881 cfg80211: expose the rfkill device to the low level driver
This will allow the low level driver to query the rfkill
state.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://lore.kernel.org/r/20210616202826.9833-1-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-06-23 11:29:13 +02:00
Johannes Berg 21b7805434 cfg80211: remove CFG80211_MAX_NUM_DIFFERENT_CHANNELS
We no longer need to put any limits here, hardware will and
mac80211-hwsim can do whatever it likes. The reason we had
this was some accounting code (still mentioned in the comment)
but that code was deleted in commit c781944b71 ("cfg80211:
Remove unused cfg80211_can_use_iftype_chan()").

Link: https://lore.kernel.org/r/20210506221159.d1d61db1d31c.Iac4da68d54b9f1fdc18a03586bbe06aeb9515425@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-06-23 10:58:56 +02:00
Johannes Berg 43076c1e07 cfg80211: fix phy80211 symlink creation
When I moved around the code here, I neglected that we could still
call register_netdev() or similar without the wiphy mutex held,
which then calls cfg80211_register_wdev() - that's also done from
cfg80211_register_netdevice(), but the phy80211 symlink creation
was only there. Now, the symlink isn't needed for a *pure* wdev,
but a netdev not registered via cfg80211_register_wdev() should
still have the symlink, so move the creation to the right place.

Cc: stable@vger.kernel.org
Fixes: 2fe8ef1062 ("cfg80211: change netdev registration/unregistration semantics")
Link: https://lore.kernel.org/r/20210608113226.a5dc4c1e488c.Ia42fe663cefe47b0883af78c98f284c5555bbe5d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-06-09 16:09:20 +02:00
Linus Torvalds 9d31d23389 Networking changes for 5.13.
Core:
 
  - bpf:
 	- allow bpf programs calling kernel functions (initially to
 	  reuse TCP congestion control implementations)
 	- enable task local storage for tracing programs - remove the
 	  need to store per-task state in hash maps, and allow tracing
 	  programs access to task local storage previously added for
 	  BPF_LSM
 	- add bpf_for_each_map_elem() helper, allowing programs to
 	  walk all map elements in a more robust and easier to verify
 	  fashion
 	- sockmap: support UDP and cross-protocol BPF_SK_SKB_VERDICT
 	  redirection
 	- lpm: add support for batched ops in LPM trie
 	- add BTF_KIND_FLOAT support - mostly to allow use of BTF
 	  on s390 which has floats in its headers files
 	- improve BPF syscall documentation and extend the use of kdoc
 	  parsing scripts we already employ for bpf-helpers
 	- libbpf, bpftool: support static linking of BPF ELF files
 	- improve support for encapsulation of L2 packets
 
  - xdp: restructure redirect actions to avoid a runtime lookup,
 	improving performance by 4-8% in microbenchmarks
 
  - xsk: build skb by page (aka generic zerocopy xmit) - improve
 	performance of software AF_XDP path by 33% for devices
 	which don't need headers in the linear skb part (e.g. virtio)
 
  - nexthop: resilient next-hop groups - improve path stability
 	on next-hops group changes (incl. offload for mlxsw)
 
  - ipv6: segment routing: add support for IPv4 decapsulation
 
  - icmp: add support for RFC 8335 extended PROBE messages
 
  - inet: use bigger hash table for IP ID generation
 
  - tcp: deal better with delayed TX completions - make sure we don't
 	give up on fast TCP retransmissions only because driver is
 	slow in reporting that it completed transmitting the original
 
  - tcp: reorder tcp_congestion_ops for better cache locality
 
  - mptcp:
 	- add sockopt support for common TCP options
 	- add support for common TCP msg flags
 	- include multiple address ids in RM_ADDR
 	- add reset option support for resetting one subflow
 
  - udp: GRO L4 improvements - improve 'forward' / 'frag_list'
 	co-existence with UDP tunnel GRO, allowing the first to take
 	place correctly	even for encapsulated UDP traffic
 
  - micro-optimize dev_gro_receive() and flow dissection, avoid
 	retpoline overhead on VLAN and TEB GRO
 
  - use less memory for sysctls, add a new sysctl type, to allow using
 	u8 instead of "int" and "long" and shrink networking sysctls
 
  - veth: allow GRO without XDP - this allows aggregating UDP
 	packets before handing them off to routing, bridge, OvS, etc.
 
  - allow specifing ifindex when device is moved to another namespace
 
  - netfilter:
 	- nft_socket: add support for cgroupsv2
 	- nftables: add catch-all set element - special element used
 	  to define a default action in case normal lookup missed
 	- use net_generic infra in many modules to avoid allocating
 	  per-ns memory unnecessarily
 
  - xps: improve the xps handling to avoid potential out-of-bound
 	accesses and use-after-free when XPS change race with other
 	re-configuration under traffic
 
  - add a config knob to turn off per-cpu netdev refcnt to catch
 	underflows in testing
 
 Device APIs:
 
  - add WWAN subsystem to organize the WWAN interfaces better and
    hopefully start driving towards more unified and vendor-
    -independent APIs
 
  - ethtool:
 	- add interface for reading IEEE MIB stats (incl. mlx5 and
 	  bnxt support)
 	- allow network drivers to dump arbitrary SFP EEPROM data,
 	  current offset+length API was a poor fit for modern SFP
 	  which define EEPROM in terms of pages (incl. mlx5 support)
 
  - act_police, flow_offload: add support for packet-per-second
 	policing (incl. offload for nfp)
 
  - psample: add additional metadata attributes like transit delay
 	for packets sampled from switch HW (and corresponding egress
 	and policy-based sampling in the mlxsw driver)
 
  - dsa: improve support for sandwiched LAGs with bridge and DSA
 
  - netfilter:
 	- flowtable: use direct xmit in topologies with IP
 	  forwarding, bridging, vlans etc.
 	- nftables: counter hardware offload support
 
  - Bluetooth:
 	- improvements for firmware download w/ Intel devices
 	- add support for reading AOSP vendor capabilities
 	- add support for virtio transport driver
 
  - mac80211:
 	- allow concurrent monitor iface and ethernet rx decap
 	- set priority and queue mapping for injected frames
 
  - phy: add support for Clause-45 PHY Loopback
 
  - pci/iov: add sysfs MSI-X vector assignment interface
 	to distribute MSI-X resources to VFs (incl. mlx5 support)
 
 New hardware/drivers:
 
  - dsa: mv88e6xxx: add support for Marvell mv88e6393x -
 	11-port Ethernet switch with 8x 1-Gigabit Ethernet
 	and 3x 10-Gigabit interfaces.
 
  - dsa: support for legacy Broadcom tags used on BCM5325, BCM5365
 	and BCM63xx switches
 
  - Microchip KSZ8863 and KSZ8873; 3x 10/100Mbps Ethernet switches
 
  - ath11k: support for QCN9074 a 802.11ax device
 
  - Bluetooth: Broadcom BCM4330 and BMC4334
 
  - phy: Marvell 88X2222 transceiver support
 
  - mdio: add BCM6368 MDIO mux bus controller
 
  - r8152: support RTL8153 and RTL8156 (USB Ethernet) chips
 
  - mana: driver for Microsoft Azure Network Adapter (MANA)
 
  - Actions Semi Owl Ethernet MAC
 
  - can: driver for ETAS ES58X CAN/USB interfaces
 
 Pure driver changes:
 
  - add XDP support to: enetc, igc, stmmac
  - add AF_XDP support to: stmmac
 
  - virtio:
 	- page_to_skb() use build_skb when there's sufficient tailroom
 	  (21% improvement for 1000B UDP frames)
 	- support XDP even without dedicated Tx queues - share the Tx
 	  queues with the stack when necessary
 
  - mlx5:
 	- flow rules: add support for mirroring with conntrack,
 	  matching on ICMP, GTP, flex filters and more
 	- support packet sampling with flow offloads
 	- persist uplink representor netdev across eswitch mode
 	  changes
 	- allow coexistence of CQE compression and HW time-stamping
 	- add ethtool extended link error state reporting
 
  - ice, iavf: support flow filters, UDP Segmentation Offload
 
  - dpaa2-switch:
 	- move the driver out of staging
 	- add spanning tree (STP) support
 	- add rx copybreak support
 	- add tc flower hardware offload on ingress traffic
 
  - ionic:
 	- implement Rx page reuse
 	- support HW PTP time-stamping
 
  - octeon: support TC hardware offloads - flower matching on ingress
 	and egress ratelimitting.
 
  - stmmac:
 	- add RX frame steering based on VLAN priority in tc flower
 	- support frame preemption (FPE)
 	- intel: add cross time-stamping freq difference adjustment
 
  - ocelot:
 	- support forwarding of MRP frames in HW
 	- support multiple bridges
 	- support PTP Sync one-step timestamping
 
  - dsa: mv88e6xxx, dpaa2-switch: offload bridge port flags like
 	learning, flooding etc.
 
  - ipa: add IPA v4.5, v4.9 and v4.11 support (Qualcomm SDX55, SM8350,
 	SC7280 SoCs)
 
  - mt7601u: enable TDLS support
 
  - mt76:
 	- add support for 802.3 rx frames (mt7915/mt7615)
 	- mt7915 flash pre-calibration support
 	- mt7921/mt7663 runtime power management fixes
 
 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE6jPA+I1ugmIBA4hXMUZtbf5SIrsFAmCKFPIACgkQMUZtbf5S
 Irtw0g/+NA8bWdHNgG4H5rya0pv2z3IieLRmSdDfKRQQXcJpklawc5MKVVaTee/Q
 5/QqgPdCsu1LAU6JXBKsKmyDDaMlQKdWuKbOqDSiAQKoMesZStTEHf9d851ZzgxA
 Cdb6O7BD3lBl/IN+oxNG+KcmD1LKquTPKGySq2mQtEdLO12ekAsranzmj4voKffd
 q9tBShpXQ7Dq77DLYfiQXVCvsizNcbbJFuxX0o9Lpb9+61ZyYAbogZSa9ypiZZwR
 I/9azRBtJg7UV1aD/cLuAfy66Qh7t63+rCxVazs5Os8jVO26P/jQdisnnOe/x+p9
 wYEmKm3GSu0V4SAPxkWW+ooKusflCeqDoMIuooKt6kbP6BRj540veGw3Ww/m5YFr
 7pLQkTSP/tSjuGQIdBE1LOP5LBO8DZeC8Kiop9V0fzAW9hFSZbEq25WW0bPj8QQO
 zA4Z7yWlslvxcfY2BdJX3wD8klaINkl/8fDWZFFsBdfFX2VeLtm7Xfduw34BJpvU
 rYT3oWr6PhtkPAKR32SUcemSfeWgIVU41eSshzRz3kez1NngBUuLlSGGSEaKbes5
 pZVt6pYFFVByyf6MTHFEoQvafZfEw04JILZpo4R5V8iTHzom0kD3Py064sBiXEw2
 B6t+OW4qgcxGblpFkK2lD4kR2s1TPUs0ckVO6sAy1x8q60KKKjY=
 =vcbA
 -----END PGP SIGNATURE-----

Merge tag 'net-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next

Pull networking updates from Jakub Kicinski:
 "Core:

   - bpf:
        - allow bpf programs calling kernel functions (initially to
          reuse TCP congestion control implementations)
        - enable task local storage for tracing programs - remove the
          need to store per-task state in hash maps, and allow tracing
          programs access to task local storage previously added for
          BPF_LSM
        - add bpf_for_each_map_elem() helper, allowing programs to walk
          all map elements in a more robust and easier to verify fashion
        - sockmap: support UDP and cross-protocol BPF_SK_SKB_VERDICT
          redirection
        - lpm: add support for batched ops in LPM trie
        - add BTF_KIND_FLOAT support - mostly to allow use of BTF on
          s390 which has floats in its headers files
        - improve BPF syscall documentation and extend the use of kdoc
          parsing scripts we already employ for bpf-helpers
        - libbpf, bpftool: support static linking of BPF ELF files
        - improve support for encapsulation of L2 packets

   - xdp: restructure redirect actions to avoid a runtime lookup,
     improving performance by 4-8% in microbenchmarks

   - xsk: build skb by page (aka generic zerocopy xmit) - improve
     performance of software AF_XDP path by 33% for devices which don't
     need headers in the linear skb part (e.g. virtio)

   - nexthop: resilient next-hop groups - improve path stability on
     next-hops group changes (incl. offload for mlxsw)

   - ipv6: segment routing: add support for IPv4 decapsulation

   - icmp: add support for RFC 8335 extended PROBE messages

   - inet: use bigger hash table for IP ID generation

   - tcp: deal better with delayed TX completions - make sure we don't
     give up on fast TCP retransmissions only because driver is slow in
     reporting that it completed transmitting the original

   - tcp: reorder tcp_congestion_ops for better cache locality

   - mptcp:
        - add sockopt support for common TCP options
        - add support for common TCP msg flags
        - include multiple address ids in RM_ADDR
        - add reset option support for resetting one subflow

   - udp: GRO L4 improvements - improve 'forward' / 'frag_list'
     co-existence with UDP tunnel GRO, allowing the first to take place
     correctly even for encapsulated UDP traffic

   - micro-optimize dev_gro_receive() and flow dissection, avoid
     retpoline overhead on VLAN and TEB GRO

   - use less memory for sysctls, add a new sysctl type, to allow using
     u8 instead of "int" and "long" and shrink networking sysctls

   - veth: allow GRO without XDP - this allows aggregating UDP packets
     before handing them off to routing, bridge, OvS, etc.

   - allow specifing ifindex when device is moved to another namespace

   - netfilter:
        - nft_socket: add support for cgroupsv2
        - nftables: add catch-all set element - special element used to
          define a default action in case normal lookup missed
        - use net_generic infra in many modules to avoid allocating
          per-ns memory unnecessarily

   - xps: improve the xps handling to avoid potential out-of-bound
     accesses and use-after-free when XPS change race with other
     re-configuration under traffic

   - add a config knob to turn off per-cpu netdev refcnt to catch
     underflows in testing

  Device APIs:

   - add WWAN subsystem to organize the WWAN interfaces better and
     hopefully start driving towards more unified and vendor-
     independent APIs

   - ethtool:
        - add interface for reading IEEE MIB stats (incl. mlx5 and bnxt
          support)
        - allow network drivers to dump arbitrary SFP EEPROM data,
          current offset+length API was a poor fit for modern SFP which
          define EEPROM in terms of pages (incl. mlx5 support)

   - act_police, flow_offload: add support for packet-per-second
     policing (incl. offload for nfp)

   - psample: add additional metadata attributes like transit delay for
     packets sampled from switch HW (and corresponding egress and
     policy-based sampling in the mlxsw driver)

   - dsa: improve support for sandwiched LAGs with bridge and DSA

   - netfilter:
        - flowtable: use direct xmit in topologies with IP forwarding,
          bridging, vlans etc.
        - nftables: counter hardware offload support

   - Bluetooth:
        - improvements for firmware download w/ Intel devices
        - add support for reading AOSP vendor capabilities
        - add support for virtio transport driver

   - mac80211:
        - allow concurrent monitor iface and ethernet rx decap
        - set priority and queue mapping for injected frames

   - phy: add support for Clause-45 PHY Loopback

   - pci/iov: add sysfs MSI-X vector assignment interface to distribute
     MSI-X resources to VFs (incl. mlx5 support)

  New hardware/drivers:

   - dsa: mv88e6xxx: add support for Marvell mv88e6393x - 11-port
     Ethernet switch with 8x 1-Gigabit Ethernet and 3x 10-Gigabit
     interfaces.

   - dsa: support for legacy Broadcom tags used on BCM5325, BCM5365 and
     BCM63xx switches

   - Microchip KSZ8863 and KSZ8873; 3x 10/100Mbps Ethernet switches

   - ath11k: support for QCN9074 a 802.11ax device

   - Bluetooth: Broadcom BCM4330 and BMC4334

   - phy: Marvell 88X2222 transceiver support

   - mdio: add BCM6368 MDIO mux bus controller

   - r8152: support RTL8153 and RTL8156 (USB Ethernet) chips

   - mana: driver for Microsoft Azure Network Adapter (MANA)

   - Actions Semi Owl Ethernet MAC

   - can: driver for ETAS ES58X CAN/USB interfaces

  Pure driver changes:

   - add XDP support to: enetc, igc, stmmac

   - add AF_XDP support to: stmmac

   - virtio:
        - page_to_skb() use build_skb when there's sufficient tailroom
          (21% improvement for 1000B UDP frames)
        - support XDP even without dedicated Tx queues - share the Tx
          queues with the stack when necessary

   - mlx5:
        - flow rules: add support for mirroring with conntrack, matching
          on ICMP, GTP, flex filters and more
        - support packet sampling with flow offloads
        - persist uplink representor netdev across eswitch mode changes
        - allow coexistence of CQE compression and HW time-stamping
        - add ethtool extended link error state reporting

   - ice, iavf: support flow filters, UDP Segmentation Offload

   - dpaa2-switch:
        - move the driver out of staging
        - add spanning tree (STP) support
        - add rx copybreak support
        - add tc flower hardware offload on ingress traffic

   - ionic:
        - implement Rx page reuse
        - support HW PTP time-stamping

   - octeon: support TC hardware offloads - flower matching on ingress
     and egress ratelimitting.

   - stmmac:
        - add RX frame steering based on VLAN priority in tc flower
        - support frame preemption (FPE)
        - intel: add cross time-stamping freq difference adjustment

   - ocelot:
        - support forwarding of MRP frames in HW
        - support multiple bridges
        - support PTP Sync one-step timestamping

   - dsa: mv88e6xxx, dpaa2-switch: offload bridge port flags like
     learning, flooding etc.

   - ipa: add IPA v4.5, v4.9 and v4.11 support (Qualcomm SDX55, SM8350,
     SC7280 SoCs)

   - mt7601u: enable TDLS support

   - mt76:
        - add support for 802.3 rx frames (mt7915/mt7615)
        - mt7915 flash pre-calibration support
        - mt7921/mt7663 runtime power management fixes"

* tag 'net-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2451 commits)
  net: selftest: fix build issue if INET is disabled
  net: netrom: nr_in: Remove redundant assignment to ns
  net: tun: Remove redundant assignment to ret
  net: phy: marvell: add downshift support for M88E1240
  net: dsa: ksz: Make reg_mib_cnt a u8 as it never exceeds 255
  net/sched: act_ct: Remove redundant ct get and check
  icmp: standardize naming of RFC 8335 PROBE constants
  bpf, selftests: Update array map tests for per-cpu batched ops
  bpf: Add batched ops support for percpu array
  bpf: Implement formatted output helpers with bstr_printf
  seq_file: Add a seq_bprintf function
  sfc: adjust efx->xdp_tx_queue_count with the real number of initialized queues
  net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
  net: fix a concurrency bug in l2tp_tunnel_register()
  net/smc: Remove redundant assignment to rc
  mpls: Remove redundant assignment to err
  llc2: Remove redundant assignment to rc
  net/tls: Remove redundant initialization of record
  rds: Remove redundant assignment to nr_sig
  dt-bindings: net: mdio-gpio: add compatible for microchip,mdio-smi0
  ...
2021-04-29 11:57:23 -07:00
Johannes Berg ea6b2098dd cfg80211: fix locking in netlink owner interface destruction
Harald Arnesen reported [1] a deadlock at reboot time, and after
he captured a stack trace a picture developed of what's going on:

The distribution he's using is using iwd (not wpa_supplicant) to
manage wireless. iwd will usually use the "socket owner" option
when it creates new interfaces, so that they're automatically
destroyed when it quits (unexpectedly or otherwise). This is also
done by wpa_supplicant, but it doesn't do it for the normal one,
only for additional ones, which is different with iwd.

Anyway, during shutdown, iwd quits while the netdev is still UP,
i.e. IFF_UP is set. This causes the stack trace that Linus so
nicely transcribed from the pictures:

cfg80211_destroy_iface_wk() takes wiphy_lock
 -> cfg80211_destroy_ifaces()
  ->ieee80211_del_iface
    ->ieeee80211_if_remove
      ->cfg80211_unregister_wdev
        ->unregister_netdevice_queue
          ->dev_close_many
            ->__dev_close_many
              ->raw_notifier_call_chain
                ->cfg80211_netdev_notifier_call
and that last call tries to take wiphy_lock again.

In commit a05829a722 ("cfg80211: avoid holding the RTNL when
calling the driver") I had taken into account the possibility of
recursing from cfg80211 into cfg80211_netdev_notifier_call() via
the network stack, but only for NETDEV_UNREGISTER, not for what
happens here, NETDEV_GOING_DOWN and NETDEV_DOWN notifications.

Additionally, while this worked still back in commit 78f22b6a3a
("cfg80211: allow userspace to take ownership of interfaces"), it
missed another corner case: unregistering a netdev will cause
dev_close() to be called, and thus stop wireless operations (e.g.
disconnecting), but there are some types of virtual interfaces in
wifi that don't have a netdev - for that we need an additional
call to cfg80211_leave().

So, to fix this mess, change cfg80211_destroy_ifaces() to not
require the wiphy_lock(), but instead make it acquire it, but
only after it has actually closed all the netdevs on the list,
and then call cfg80211_leave() as well before removing them
from the driver, to fix the second issue. The locking change in
this requires modifying the nl80211 call to not get the wiphy
lock passed in, but acquire it by itself after flushing any
potentially pending destruction requests.

[1] https://lore.kernel.org/r/09464e67-f3de-ac09-28a3-e27b7914ee7d@skogtun.org

Cc: stable@vger.kernel.org # 5.12
Reported-by: Harald Arnesen <harald@skogtun.org>
Fixes: 776a39b819 ("cfg80211: call cfg80211_destroy_ifaces() with wiphy lock held")
Fixes: 78f22b6a3a ("cfg80211: allow userspace to take ownership of interfaces")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Tested-by: Harald Arnesen <harald@skogtun.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-04-27 08:30:49 -07:00
Emmanuel Grumbach 6f779a66dc cfg80211: allow specifying a reason for hw_rfkill
rfkill now allows to report a reason for the hw_rfkill state.
Allow cfg80211 drivers to specify this reason.
Keep the current API to use the default reason
(RFKILL_HARD_BLOCK_SIGNAL).

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://lore.kernel.org/r/20210322204633.102581-4-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-04-08 13:05:56 +02:00
Andrei Vagin 0854fa82c9 net: remove the new_ifindex argument from dev_change_net_namespace
Here is only one place where we want to specify new_ifindex. In all
other cases, callers pass 0 as new_ifindex. It looks reasonable to add a
low-level function with new_ifindex and to convert
dev_change_net_namespace to a static inline wrapper.

Fixes: eeb85a14ee ("net: Allow to specify ifindex when device is moved to another namespace")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-04-07 14:43:28 -07:00
Andrei Vagin eeb85a14ee net: Allow to specify ifindex when device is moved to another namespace
Currently, we can specify ifindex on link creation. This change allows
to specify ifindex when a device is moved to another network namespace.

Even now, a device ifindex can be changed if there is another device
with the same ifindex in the target namespace. So this change doesn't
introduce completely new behavior, it adds more control to the process.

CRIU users want to restore containers with pre-created network devices.
A user will provide network devices and instructions where they have to
be restored, then CRIU will restore network namespaces and move devices
into them. The problem is that devices have to be restored with the same
indexes that they have before C/R.

Cc: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
Suggested-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-04-05 14:49:40 -07:00
Johannes Berg 40c575d1ec cfg80211: fix netdev registration deadlock
If register_netdevice() fails after having called cfg80211's
netdev notifier (cfg80211_netdev_notifier_call) it will call
the notifier again with UNREGISTER. This would then lock the
wiphy mutex because we're marked as registered, which causes
a deadlock.

Fix this by separately keeping track of whether or not we're
in the middle of registering to also skip the notifier call
on this unregister.

Reported-by: syzbot+2ae0ca9d7737ad1a62b7@syzkaller.appspotmail.com
Fixes: a05829a722 ("cfg80211: avoid holding the RTNL when calling the driver")
Link: https://lore.kernel.org/r/20210201192048.ed8bad436737.I7cae042c44b15f80919a285799a15df467e9d42d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-02-01 19:30:54 +01:00
Johannes Berg 776a39b819 cfg80211: call cfg80211_destroy_ifaces() with wiphy lock held
This is needed since it calls into the driver, which must have the
same context as if we got to destroy an interface through nl80211.
Fix this, and add a direct lockdep assertion so we don't see it
pop up only when the driver calls back to cfg80211.

Fixes: a05829a722 ("cfg80211: avoid holding the RTNL when calling the driver")
Reported-by: syzbot+4305e814f9b267131776@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20210128183454.d31df9cbd7ce.I1beb07c9492f0ade900e864a098c57041e7a7ebf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-01-28 19:11:11 +01:00