diff mbox series

[01/12] wifi: mwifiex: add missing locking

Message ID 20240826-mwifiex-cleanup-1-v1-1-56e6f8e056ec@pengutronix.de (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series mwifiex: two fixes and cleanup | expand

Commit Message

Sascha Hauer Aug. 26, 2024, 11:01 a.m. UTC
cfg80211_rx_assoc_resp() and cfg80211_rx_mlme_mgmt() need to be called
with the wiphy locked, so lock it before calling these functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 ++
 drivers/net/wireless/marvell/mwifiex/util.c   | 2 ++
 2 files changed, 4 insertions(+)

Comments

Francesco Dolcini Aug. 27, 2024, 11:55 a.m. UTC | #1
On Mon, Aug 26, 2024 at 01:01:22PM +0200, Sascha Hauer wrote:
> cfg80211_rx_assoc_resp() and cfg80211_rx_mlme_mgmt() need to be called
> with the wiphy locked, so lock it before calling these functions.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Fixes: 36995892c271 ("wifi: mwifiex: add host mlme for client mode")
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
David Lin Sept. 2, 2024, 6:30 a.m. UTC | #2
Thanks. I will update this fix to nxpwifi.

> -----Original Message-----
> From: Francesco Dolcini <francesco@dolcini.it>
> Sent: Tuesday, August 27, 2024 7:56 PM
> To: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Brian Norris <briannorris@chromium.org>; Francesco Dolcini
> <francesco@dolcini.it>; Kalle Valo <kvalo@kernel.org>;
> linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXT] Re: [PATCH 01/12] wifi: mwifiex: add missing locking
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> On Mon, Aug 26, 2024 at 01:01:22PM +0200, Sascha Hauer wrote:
> > cfg80211_rx_assoc_resp() and cfg80211_rx_mlme_mgmt() need to be called
> > with the wiphy locked, so lock it before calling these functions.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> 
> Fixes: 36995892c271 ("wifi: mwifiex: add host mlme for client mode")
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 7894102f03eb0..cdfb307e75131 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -938,8 +938,10 @@  void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter)
 		assoc_resp.links[0].bss = priv->req_bss;
 		assoc_resp.buf = priv->assoc_rsp_buf;
 		assoc_resp.len = priv->assoc_rsp_size;
+		wiphy_lock(priv->wdev.wiphy);
 		cfg80211_rx_assoc_resp(priv->netdev,
 				       &assoc_resp);
+		wiphy_unlock(priv->wdev.wiphy);
 		priv->assoc_rsp_size = 0;
 	}
 }
diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
index 42c04bf858da3..1f1f6280a0f25 100644
--- a/drivers/net/wireless/marvell/mwifiex/util.c
+++ b/drivers/net/wireless/marvell/mwifiex/util.c
@@ -494,7 +494,9 @@  mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 			}
 		}
 
+		wiphy_lock(priv->wdev.wiphy);
 		cfg80211_rx_mlme_mgmt(priv->netdev, skb->data, pkt_len);
+		wiphy_unlock(priv->wdev.wiphy);
 	}
 
 	if (priv->adapter->host_mlme_enabled &&