mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 18:19:28 +09:00
mac80211_hwsim: Fix a possible sleep-in-atomic bug in hwsim_get_radio_nl
[ Upstream commit 162bd5e5fd ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
647ed111f7
commit
52a63f35cd
@@ -3220,7 +3220,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info)
|
||||
if (!net_eq(wiphy_net(data->hw->wiphy), genl_info_net(info)))
|
||||
continue;
|
||||
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
|
||||
if (!skb) {
|
||||
res = -ENOMEM;
|
||||
goto out_err;
|
||||
|
||||
Reference in New Issue
Block a user