Skip to content

Commit 7c8a863

Browse files
tokenrovegregkh
authored andcommitted
cfg80211: check vendor command doit pointer before use
[ Upstream commit 4052d3d ] In the case where a vendor command does not implement doit, and has no flags set, doit would not be validated and a NULL pointer dereference would occur, for example when invoking the vendor command via iw. I encountered this while developing new vendor commands. Perhaps in practice it is advisable to always implement doit along with dumpit, but it seems reasonable to me to always check doit anyway, not just when NEED_WDEV. Signed-off-by: Julian Squires <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 83ea637 commit 7c8a863

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/wireless/nl80211.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12949,13 +12949,13 @@ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)
1294912949
if (!wdev_running(wdev))
1295012950
return -ENETDOWN;
1295112951
}
12952-
12953-
if (!vcmd->doit)
12954-
return -EOPNOTSUPP;
1295512952
} else {
1295612953
wdev = NULL;
1295712954
}
1295812955

12956+
if (!vcmd->doit)
12957+
return -EOPNOTSUPP;
12958+
1295912959
if (info->attrs[NL80211_ATTR_VENDOR_DATA]) {
1296012960
data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]);
1296112961
len = nla_len(info->attrs[NL80211_ATTR_VENDOR_DATA]);

0 commit comments

Comments
 (0)