f48fa38e5e96ab6b8c92b5b728d302a23e349616
[openwrt/openwrt.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 2 Oct 2024 11:45:35 +0200
3 Subject: [PATCH] wifi: mac80211: do not pass a stopped vif to the driver in
4 .get_txpower
5
6 Avoid potentially crashing in the driver because of uninitialized private data
7
8 Fixes: 5b3dc42b1b0d ("mac80211: add support for driver tx power reporting")
9 Cc: stable@vger.kernel.org
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
13 --- a/net/mac80211/cfg.c
14 +++ b/net/mac80211/cfg.c
15 @@ -3134,7 +3134,8 @@ static int ieee80211_get_tx_power(struct
16 struct ieee80211_local *local = wiphy_priv(wiphy);
17 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
18
19 - if (local->ops->get_txpower)
20 + if (local->ops->get_txpower &&
21 + (sdata->flags & IEEE80211_SDATA_IN_DRIVER))
22 return drv_get_txpower(local, sdata, dbm);
23
24 if (local->emulate_chanctx)