]> git.baikalelectronics.ru Git - kernel.git/commit
wifi: mac80211_hwsim: fix race condition in pending packet
authorJeongik Cha <jeongik@google.com>
Mon, 4 Jul 2022 08:43:54 +0000 (17:43 +0900)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Jul 2022 08:22:02 +0000 (10:22 +0200)
commit2e05bcefd0a8a525e7145f84b5c5c2d4faffda6d
tree66b1702d07769591234a775bb8a80af4d98eb7eb
parent41922b26c95d826f8858ccf71dcb418d74588067
wifi: mac80211_hwsim: fix race condition in pending packet

A pending packet uses a cookie as an unique key, but it can be duplicated
because it didn't use atomic operators.

And also, a pending packet can be null in hwsim_tx_info_frame_received_nl
due to race condition with mac80211_hwsim_stop.

For this,
 * Use an atomic type and operator for a cookie
 * Add a lock around the loop for pending packets

Signed-off-by: Jeongik Cha <jeongik@google.com>
Link: https://lore.kernel.org/r/20220704084354.3556326-1-jeongik@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/mac80211_hwsim.c