Skip to content

Commit 4052d3d

Browse files
tokenrovejmberg-intel
authored andcommitted
cfg80211: check vendor command doit pointer before use
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]>
1 parent 5e43540 commit 4052d3d

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
@@ -13266,13 +13266,13 @@ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)
1326613266
if (!wdev_running(wdev))
1326713267
return -ENETDOWN;
1326813268
}
13269-
13270-
if (!vcmd->doit)
13271-
return -EOPNOTSUPP;
1327213269
} else {
1327313270
wdev = NULL;
1327413271
}
1327513272

13273+
if (!vcmd->doit)
13274+
return -EOPNOTSUPP;
13275+
1327613276
if (info->attrs[NL80211_ATTR_VENDOR_DATA]) {
1327713277
data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]);
1327813278
len = nla_len(info->attrs[NL80211_ATTR_VENDOR_DATA]);

0 commit comments

Comments
 (0)