From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 08/40] wifi: mac80211: add more ops assertions
Date: Mon, 28 Aug 2023 13:59:36 +0200 [thread overview]
Message-ID: <20230828135927.c6d213b259ee.I63b73b2f3cdd145573d3c1f5ea90074f3561912a@changeid> (raw)
In-Reply-To: <20230828115927.116700-41-johannes@sipsolutions.net>
From: Johannes Berg <johannes.berg@intel.com>
Add more might_sleep() checks and check sdata-in-driver
for one additional place.
type=feature
ticket=jira:WIFI-314309
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/driver-ops.c | 2 ++
net/mac80211/driver-ops.h | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/net/mac80211/driver-ops.c b/net/mac80211/driver-ops.c
index 30cd0c905a24..376dae58b5a6 100644
--- a/net/mac80211/driver-ops.c
+++ b/net/mac80211/driver-ops.c
@@ -285,6 +285,8 @@ int drv_assign_vif_chanctx(struct ieee80211_local *local,
{
int ret = 0;
+ might_sleep();
+
drv_verify_link_exists(sdata, link_conf);
if (!check_sdata_in_driver(sdata))
return -EIO;
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index c4505593ba7a..d95ff2282f54 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -40,6 +40,8 @@ static inline void drv_tx(struct ieee80211_local *local,
static inline void drv_sync_rx_queues(struct ieee80211_local *local,
struct sta_info *sta)
{
+ might_sleep();
+
if (local->ops->sync_rx_queues) {
trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta);
local->ops->sync_rx_queues(&local->hw);
@@ -569,6 +571,8 @@ static inline void drv_sta_statistics(struct ieee80211_local *local,
struct ieee80211_sta *sta,
struct station_info *sinfo)
{
+ might_sleep();
+
sdata = get_bss_sdata(sdata);
if (!check_sdata_in_driver(sdata))
return;
@@ -616,6 +620,8 @@ static inline int drv_get_survey(struct ieee80211_local *local, int idx,
{
int ret = -EOPNOTSUPP;
+ might_sleep();
+
trace_drv_get_survey(local, idx, survey);
if (local->ops->get_survey)
@@ -797,6 +803,8 @@ static inline void drv_set_rekey_data(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct cfg80211_gtk_rekey_data *data)
{
+ might_sleep();
+
if (!check_sdata_in_driver(sdata))
return;
@@ -987,6 +995,8 @@ static inline void drv_stop_ap(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_bss_conf *link_conf)
{
+ might_sleep();
+
/* make sure link_conf is protected */
drv_verify_link_exists(sdata, link_conf);
@@ -1016,6 +1026,8 @@ drv_set_default_unicast_key(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
int key_idx)
{
+ might_sleep();
+
if (!check_sdata_in_driver(sdata))
return;
@@ -1046,6 +1058,8 @@ drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
{
struct ieee80211_local *local = sdata->local;
+ might_sleep();
+
if (local->ops->channel_switch_beacon) {
trace_drv_channel_switch_beacon(local, sdata, chandef);
local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
@@ -1060,6 +1074,8 @@ drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
struct ieee80211_local *local = sdata->local;
int ret = 0;
+ might_sleep();
+
if (!check_sdata_in_driver(sdata))
return -EIO;
@@ -1077,6 +1093,8 @@ drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
struct ieee80211_local *local = sdata->local;
int ret = 0;
+ might_sleep();
+
if (!check_sdata_in_driver(sdata))
return -EIO;
@@ -1092,6 +1110,8 @@ drv_abort_channel_switch(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
+ might_sleep();
+
if (!check_sdata_in_driver(sdata))
return;
@@ -1107,6 +1127,8 @@ drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata,
{
struct ieee80211_local *local = sdata->local;
+ might_sleep();
+
if (!check_sdata_in_driver(sdata))
return;
@@ -1163,6 +1185,8 @@ static inline int drv_get_txpower(struct ieee80211_local *local,
{
int ret;
+ might_sleep();
+
if (!local->ops->get_txpower)
return -EOPNOTSUPP;
@@ -1267,6 +1291,10 @@ drv_get_ftm_responder_stats(struct ieee80211_local *local,
{
u32 ret = -EOPNOTSUPP;
+ might_sleep();
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
if (local->ops->get_ftm_responder_stats)
ret = local->ops->get_ftm_responder_stats(&local->hw,
&sdata->vif,
@@ -1436,6 +1464,8 @@ static inline void drv_sta_set_4addr(struct ieee80211_local *local,
struct ieee80211_sta *sta, bool enabled)
{
sdata = get_bss_sdata(sdata);
+
+ might_sleep();
if (!check_sdata_in_driver(sdata))
return;
@@ -1451,6 +1481,8 @@ static inline void drv_sta_set_decap_offload(struct ieee80211_local *local,
bool enabled)
{
sdata = get_bss_sdata(sdata);
+
+ might_sleep();
if (!check_sdata_in_driver(sdata))
return;
@@ -1526,6 +1558,8 @@ static inline int drv_net_setup_tc(struct ieee80211_local *local,
{
int ret = -EOPNOTSUPP;
+ might_sleep();
+
sdata = get_bss_sdata(sdata);
trace_drv_net_setup_tc(local, sdata, type);
if (local->ops->net_setup_tc)
--
2.41.0
next prev parent reply other threads:[~2023-08-28 12:06 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 11:59 [PATCH 00/40] wifi: cfg80211/mac80211: locking cleanups Johannes Berg
2023-08-28 11:59 ` [PATCH 01/40] wifi: mac80211: debugfs: lock wiphy instead of RTNL Johannes Berg
2023-08-28 11:59 ` [PATCH 02/40] wifi: mac80211: hold wiphy lock in netdev/link debugfs Johannes Berg
2023-08-28 11:59 ` [PATCH 03/40] wifi: mac80211: lock wiphy for aggregation debugfs Johannes Berg
2023-08-28 11:59 ` [PATCH 04/40] wifi: cfg80211: check RTNL when iterating devices Johannes Berg
2023-08-28 11:59 ` [PATCH 05/40] wifi: cfg80211: add flush functions for wiphy work Johannes Berg
2023-08-28 11:59 ` [PATCH 06/40] wifi: mac80211: flush wiphy work where appropriate Johannes Berg
2023-08-28 11:59 ` [PATCH 07/40] wifi: mac80211: convert A-MPDU work to wiphy work Johannes Berg
2023-08-28 11:59 ` Johannes Berg [this message]
2023-08-28 11:59 ` [PATCH 09/40] wifi: mac80211: move DFS CAC " Johannes Berg
2023-08-28 11:59 ` [PATCH 10/40] wifi: mac80211: move radar detect " Johannes Berg
2023-08-28 11:59 ` [PATCH 11/40] wifi: mac80211: move scan " Johannes Berg
2023-08-28 11:59 ` [PATCH 12/40] wifi: mac80211: move monitor " Johannes Berg
2023-08-28 11:59 ` [PATCH 13/40] wifi: mac80211: lock wiphy in IP address notifier Johannes Berg
2023-08-28 11:59 ` [PATCH 14/40] wifi: mac80211: move offchannel works to wiphy work Johannes Berg
2023-08-28 11:59 ` [PATCH 15/40] wifi: mac80211: move link activation work " Johannes Berg
2023-08-28 11:59 ` [PATCH 16/40] wifi: mac80211: move dynamic PS " Johannes Berg
2023-08-28 11:59 ` [PATCH 17/40] wifi: mac80211: move sched-scan stop work " Johannes Berg
2023-08-28 11:59 ` [PATCH 18/40] wifi: mac80211: move TDLS " Johannes Berg
2023-08-28 11:59 ` [PATCH 19/40] wifi: mac80211: move key tailroom " Johannes Berg
2023-08-28 11:59 ` [PATCH 20/40] wifi: mac80211: move tspec " Johannes Berg
2023-08-28 11:59 ` [PATCH 21/40] wifi: mac80211: move filter reconfig " Johannes Berg
2023-08-28 11:59 ` [PATCH 22/40] wifi: mac80211: move CSA finalize " Johannes Berg
2023-08-28 11:59 ` [PATCH 23/40] wifi: mac80211: move color change " Johannes Berg
2023-08-28 11:59 ` [PATCH 24/40] wifi: mac80211: check wiphy mutex in ops Johannes Berg
2023-08-28 11:59 ` [PATCH 25/40] wifi: cfg80211: reg: hold wiphy mutex for wdev iteration Johannes Berg
2023-08-28 11:59 ` [PATCH 26/40] wifi: cfg80211: sme: hold wiphy lock " Johannes Berg
2023-08-28 11:59 ` [PATCH 27/40] wifi: cfg80211: hold wiphy lock in cfg80211_any_wiphy_oper_chan() Johannes Berg
2023-08-28 11:59 ` [PATCH 28/40] wifi: cfg80211: check wiphy mutex is held for wdev mutex Johannes Berg
2023-08-28 11:59 ` [PATCH 29/40] wifi: mac80211: ethtool: hold wiphy mutex Johannes Berg
2023-08-28 11:59 ` [PATCH 30/40] wifi: mac80211: hold wiphy_lock around concurrency checks Johannes Berg
2023-08-28 11:59 ` [PATCH 31/40] wifi: mac80211: extend wiphy lock in interface removal Johannes Berg
2023-08-28 12:00 ` [PATCH 32/40] wifi: mac80211: take wiphy lock for MAC addr change Johannes Berg
2023-08-28 12:00 ` [PATCH 33/40] wifi: mac80211: remove sta_mtx Johannes Berg
2023-08-28 12:00 ` [PATCH 34/40] wifi: mac80211: remove key_mtx Johannes Berg
2023-08-28 12:00 ` [PATCH 35/40] wifi: mac80211: remove chanctx_mtx Johannes Berg
2023-08-28 12:00 ` [PATCH 36/40] wifi: mac80211: remove ampdu_mlme.mtx Johannes Berg
2023-08-28 12:00 ` [PATCH 37/40] wifi: mac80211: remove local->mtx Johannes Berg
2023-08-28 12:00 ` [PATCH 38/40] wifi: mac80211: reduce iflist_mtx Johannes Berg
2023-08-28 12:00 ` [PATCH 39/40] wifi: mac80211: set wiphy for virtual monitors Johannes Berg
2023-08-28 12:00 ` [PATCH 40/40] wifi: cfg80211: remove wdev mutex Johannes Berg
2023-08-29 10:18 ` [PATCH v2 " Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230828135927.c6d213b259ee.I63b73b2f3cdd145573d3c1f5ea90074f3561912a@changeid \
--to=johannes@sipsolutions.net \
--cc=emmanuel.grumbach@intel.com \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).