[PATCH] mt76: hold RCU lock when calling ieee80211_find_sta_by_ifaddr()

Shuah Khan skhan at linuxfoundation.org
Fri Feb 12 12:20:27 EST 2021

On 2/11/21 10:36 PM, Felix Fietkau wrote:
> On 2021-02-12 03:13, Shuah Khan wrote:
>> ieee80211_find_sta_by_ifaddr() must be called under the RCU lock and
>> the resulting pointer is only valid under RCU lock as well.
>> Fix mt76_check_sta() to hold RCU read lock before it calls
>> ieee80211_find_sta_by_ifaddr() and release it when the resulting
>> pointer is no longer needed.
>> This problem was found while reviewing code to debug RCU warn from
>> ath10k_wmi_tlv_parse_peer_stats_info() and a subsequent manual audit
>> of other callers of ieee80211_find_sta_by_ifaddr() that don't hold
>> RCU read lock.
>> Signed-off-by: Shuah Khan <skhan at linuxfoundation.org>
> If I'm not mistaken, this patch is unnecessary. mt76_check_sta is only
> called from mt76_rx_poll_complete, which itself is only called under RCU
> lock.

Yes. You are right. I checked the caller of this routine and didn't
go further up. :)

-- Shuah

More information about the linux-arm-kernel mailing list