wifi: mac80211: Allow some cleanup even if sdata-not-in-driver
PATCH 1/1 wifi: mac80211: Allow some cleanup even if sdata-not-in-driver
From: Ben Greear <[email protected]>
When ax210 firmware crashes and radio cannot recover, sometimes use-after-free errors are seen due to txqs not being properly cleanedup (I think).
Logging shows that the sdata-not-in-driver checks are stopping cleanup actions from happening.
So, instead warn but allow calls to the driver to clean up objects even if sdata-not-in-driver is true.
This appears to help this problem, but system is still crashing (perhaps due to not directly related problems), so this patch needs review before going upstream.
Signed-off-by Ben Greear <[email protected]>
--- net/mac80211/driver-ops.c | 5 +++-- net/mac80211/driver-ops.h | 14 +++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-)
net/mac80211/driver-ops.c +3 -2
@@ -105,8 +105,9 @@ void drv_remove_interface(struct ieee80211_local *local, {might_sleep (); -if (!check_sdata_in_driver (sdata)) -return ; +if (!check_sdata_in_driver (sdata)) { +pr_err ("drv-remove-interface, sdata-not-in-driver, but will continue in hopes it cleans something up.\n" ); + }trace_drv_remove_interface (local, sdata); local->ops->remove_interface (&local->hw, &sdata->vif);
net/mac80211/driver-ops.h +9 -5
@@ -513,8 +513,9 @@ static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,might_sleep (); sdata =get_bss_sdata (sdata); -if (!check_sdata_in_driver (sdata)) -return ; +if (!check_sdata_in_driver (sdata)) { +pr_err ("drv-sta-pre-rcu-remove, sdata-not-in-driver, but will continue in hopes it cleans something up.\n" ); + }trace_drv_sta_pre_rcu_remove (local, sdata, &sta->sta);if (local->ops->sta_pre_rcu_remove)
@@ -632,8 +633,9 @@ static inline void drv_flush(struct ieee80211_local *local,might_sleep (); -if (sdata && !check_sdata_in_driver (sdata)) -return ; +if (sdata && !check_sdata_in_driver (sdata)) { +pr_err ("drv_flush, sdata-not-in-driver, but will continue in hopes it cleans something up.\n" ); + }trace_drv_flush (local, queues[0 ], drop);/* NOTE: Only ath10k might want more queues than fits in 32-bits,
@@ -870,8 +872,10 @@ drv_mgd_protect_tdls_discover(struct ieee80211_local *local, {might_sleep (); -if (!check_sdata_in_driver (sdata)) +if (!check_sdata_in_driver (sdata)) { +pr_err ("drv-unassing-vif-chantx, sdata-not-in-driver, but will continue in hopes it cleans something up.\n" );return ; + }WARN_ON_ONCE (sdata->vif.type !=NL80211_IFTYPE_STATION );trace_drv_mgd_protect_tdls_discover (local, sdata);
Signature · 1 line
2.39.1