mac80211_hwsim: Fix a possible sleep-in-atomic bug in hwsim_get_radio_nl
authorJia-Ju Bai <baijiaju1990@163.com>
Tue, 12 Dec 2017 09:26:36 +0000 (17:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:25 +0000 (10:24 +0100)
commit52a63f35cd70fd2fdfdf148b1896d2659c5aa3ed
tree418d180c22ab4b9d338f14264ba317a2e2d156be
parent647ed111f78ffc7fe6bd654c615ddbd013e2c44a
mac80211_hwsim: Fix a possible sleep-in-atomic bug in hwsim_get_radio_nl

[ Upstream commit 162bd5e5fd921785077b5862d8f2ffabe2fe11e5 ]

The driver may sleep under a spinlock.
The function call path is:
hwsim_get_radio_nl (acquire the spinlock)
  nlmsg_new(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.

This bug is found by my static analysis tool(DSAC) and checked by my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/mac80211_hwsim.c