On 8/25/2024 6:49 PM, Baochen Qiang wrote: > Currently ath12k_sta::rx_stats/tx_stats would only get freed when the station > transit from NONE to NOTEXIST state within ath11k_mac_op_sta_state(). However > in reset scenario, there is no chance for it to go through such transition. > Further, after reset, when a new connection to AP starts, ath12k_sta is zerod > in NOTEXIST to NONE transition, making rx_stats/tx_stats leaked: > > Kmemleak reports: > unreferenced object 0xffff9a3cd0a23400 (size 1024): > backtrace (crc 21ee4c52): > kmalloc_trace_noprof+0x2ba/0x360 > ath11k_mac_op_sta_state+0x1b6/0xca0 [ath11k] > drv_sta_state+0x11e/0x9c0 [mac80211] > sta_info_insert_rcu+0x469/0x880 [mac80211] > sta_info_insert+0x10/0x80 [mac80211] > ieee80211_prep_connection+0x295/0x950 [mac80211] > ieee80211_mgd_auth+0x230/0x5a0 [mac80211] > cfg80211_mlme_auth+0xeb/0x2a0 [cfg80211] > > Add a new function which frees them, and call it during reset to fix this issue. > > Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30 > > Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") > Signed-off-by: Baochen Qiang <quic_bqiang@xxxxxxxxxxx> Acked-by: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx>