[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55a6644c62e7c955d6dacd9a10f945a199f47277.camel@sipsolutions.net>
Date: Fri, 11 Aug 2023 11:54:15 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Max Schulze <max.schulze@...ine.de>, Arend van Spriel
<aspriel@...il.com>, Franky Lin <franky.lin@...adcom.com>, Hante Meuleman
<hante.meuleman@...adcom.com>, Kalle Valo <kvalo@...nel.org>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
linux-wireless@...r.kernel.org, brcm80211-dev-list.pdl@...adcom.com,
SHA-cyfmac-dev-list@...ineon.com, netdev@...r.kernel.org
Subject: Re: [PATCH] wifi: nl80211: avoid NULL-ptr deref after
cfg80211_cqm_rssi_update
On Fri, 2023-08-11 at 09:30 +0200, Max Schulze wrote:
> In cfg80211_cqm_rssi_notify, when calling cfg80211_cqm_rssi_update, this might free
> the wdev->cqm_config . Check for this when it returns.
That doesn't seem right? How does cfg80211_cqm_rssi_update() free it?
> This has been observed on brcmfmac, when a RSSI event is generated just right
> after disconnecting from AP. Then probing for STA details returns nothing, as
> evidenced i.e. by
> "ieee80211 phy0: brcmf_cfg80211_get_station: GET STA INFO failed, -52".
I think the issue then isn't that this frees it but rather than a free
of it races with the reporting?
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -19088,7 +19088,7 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
>
> cfg80211_cqm_rssi_update(rdev, dev);
>
> - if (rssi_level == 0)
> + if (rssi_level == 0 && wdev->cqm_config)
> rssi_level = wdev->cqm_config->last_rssi_event_value;
>
But if it's a race, then this isn't actually going to really fix the
issue, rather it just makes it (much) less likely.
Since we can probably neither lock the wdev here nor require calls to
this function with wdev lock held, it looks like we need to protect the
pointer with RCU instead?
johannes
Powered by blists - more mailing lists