Skip to content

Commit

Permalink
cfg80211: protect fools returning NULL in add_virtual_intf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafał Miłecki authored and Johannes Berg committed Nov 19, 2014
1 parent c7ab508 commit d687cbb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit d687cbb

Please sign in to comment.