wifi: iwlwifi: mvm: Add locking to the rate read flow
authorAriel Malamud <ariel.malamud@intel.com>
Sun, 14 May 2023 09:15:55 +0000 (12:15 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:34:15 +0000 (10:34 +0200)
commit7402fb48efff67be21392e81df8a6c51bc491c6f
tree0fe85f4d6579107fb6a2a8e0effb14f697addb9d
parent788f129f6370eab75ecf7abbec5f8a81e5b73d2c
wifi: iwlwifi: mvm: Add locking to the rate read flow

[ Upstream commit a8938bc881d2a03f9b77f19fae924fe798a01285 ]

The rs_drv_get_rate flow reads the lq_sta to return the optimal rate
for tx frames. This read flow is not protected thereby leaving
a small window, a few instructions wide, open to contention by an
asynchronous rate update. Indeed this race condition was hit and the
update occurred in the middle of the read.

Fix this by locking the lq_sta struct during read.

Signed-off-by: Ariel Malamud <ariel.malamud@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230514120631.b52c9ed5c379.I15290b78e0d966c1b68278263776ca9de841d5fe@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/intel/iwlwifi/mvm/rs.c