]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: do not pass a stopped vif to the driver in .get_txpower
authorFelix Fietkau <nbd@nbd.name>
Wed, 2 Oct 2024 09:56:30 +0000 (11:56 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 8 Oct 2024 19:24:19 +0000 (21:24 +0200)
Avoid potentially crashing in the driver because of uninitialized private data

Fixes: 5b3dc42b1b0d ("mac80211: add support for driver tx power reporting")
Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/20241002095630.22431-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c

index 13294cc20a9ba17f59438f5ec6e538a12ab6e2ae..6dfc61a9acd4a57480e13eb81fad7a53215531d7 100644 (file)
@@ -3143,7 +3143,8 @@ static int ieee80211_get_tx_power(struct wiphy *wiphy,
        struct ieee80211_local *local = wiphy_priv(wiphy);
        struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
 
-       if (local->ops->get_txpower)
+       if (local->ops->get_txpower &&
+           (sdata->flags & IEEE80211_SDATA_IN_DRIVER))
                return drv_get_txpower(local, sdata, dbm);
 
        if (local->emulate_chanctx)