]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mac80211: clear vif drv_priv after remove_interface when stopping
authorFelix Fietkau <nbd@nbd.name>
Thu, 4 Jul 2024 13:09:47 +0000 (15:09 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 8 Jul 2024 16:28:47 +0000 (18:28 +0200)
Avoid reusing stale driver data when an interface is brought down and up
again. In order to avoid having to duplicate the memset in every single
driver, do it here.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/20240704130947.48609-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c

index 6d969d9f1ac9932fd707962ec7aef573d2c69ff3..97aee0a1a39a5a8bbdc34b8188749dfa783ad336 100644 (file)
@@ -689,8 +689,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
 
                fallthrough;
        default:
-               if (going_down)
-                       drv_remove_interface(local, sdata);
+               if (!going_down)
+                       break;
+               drv_remove_interface(local, sdata);
+
+               /* Clear private driver data to prevent reuse */
+               memset(sdata->vif.drv_priv, 0, local->hw.vif_data_size);
        }
 
        ieee80211_recalc_ps(local);