Commit 162bd5e5 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Johannes Berg

mac80211_hwsim: Fix a possible sleep-in-atomic bug in hwsim_get_radio_nl

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: default avatarJia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5d324073
...@@ -3216,7 +3216,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info) ...@@ -3216,7 +3216,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))) if (!net_eq(wiphy_net(data->hw->wiphy), genl_info_net(info)))
continue; continue;
skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
if (!skb) { if (!skb) {
res = -ENOMEM; res = -ENOMEM;
goto out_err; goto out_err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment