summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-11-14 20:43:28 +0300
committerJohannes Berg <johannes.berg@intel.com>2014-11-19 20:50:34 +0300
commitd687cbb703f50980e155c5642cf229ec2bb45e3e (patch)
tree6d4d167a3b672ad05a814d899bbbde8a89240e94 /net/wireless
parentc7ab508190aee6b4a62cfab7ee08457602468672 (diff)
downloadlinux-d687cbb703f50980e155c5642cf229ec2bb45e3e.tar.xz
cfg80211: protect fools returning NULL in add_virtual_intf
Callback add_virtual_intf is supposed to return ERR_PTR and trying to return NULL results in some "Unable to handle kernel paging request", etc. As it may be complicated to debug & trace, let's catch it (WARN). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dd5a827f9cb0..5cfd75dfff67 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2645,7 +2645,10 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
wdev = rdev_add_virtual_intf(rdev,
nla_data(info->attrs[NL80211_ATTR_IFNAME]),
type, err ? NULL : &flags, &params);
- if (IS_ERR(wdev)) {
+ if (WARN_ON(!wdev)) {
+ nlmsg_free(msg);
+ return -EPROTO;
+ } else if (IS_ERR(wdev)) {
nlmsg_free(msg);
return PTR_ERR(wdev);
}