352-wifi-mac80211-fix-invalid-drv_sta_pre_rcu_remove-cal.patch 853 B

12345678910111213141516171819202122232425
  1. From: Felix Fietkau <[email protected]>
  2. Date: Fri, 24 Mar 2023 13:04:17 +0100
  3. Subject: [PATCH] wifi: mac80211: fix invalid drv_sta_pre_rcu_remove calls for
  4. non-uploaded sta
  5. Avoid potential data corruption issues caused by uninitialized driver
  6. private data structures.
  7. Reported-by: Brian Coverstone <[email protected]>
  8. Fixes: 6a9d1b91f34d ("mac80211: add pre-RCU-sync sta removal driver operation")
  9. Signed-off-by: Felix Fietkau <[email protected]>
  10. ---
  11. --- a/net/mac80211/sta_info.c
  12. +++ b/net/mac80211/sta_info.c
  13. @@ -1041,7 +1041,8 @@ static int __must_check __sta_info_destr
  14. list_del_rcu(&sta->list);
  15. sta->removed = true;
  16. - drv_sta_pre_rcu_remove(local, sta->sdata, sta);
  17. + if (sta->uploaded)
  18. + drv_sta_pre_rcu_remove(local, sta->sdata, sta);
  19. if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
  20. rcu_access_pointer(sdata->u.vlan.sta) == sta)