Skip to content

Commit 71a5362

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 705a601 commit 71a5362

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
@@ -11317,13 +11317,13 @@ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)
1131711317
if (!wdev->netdev && !wdev->p2p_started)
1131811318
return -ENETDOWN;
1131911319
}
11320-
11321-
if (!vcmd->doit)
11322-
return -EOPNOTSUPP;
1132311320
} else {
1132411321
wdev = NULL;
1132511322
}
1132611323

11324+
if (!vcmd->doit)
11325+
return -EOPNOTSUPP;
11326+
1132711327
if (info->attrs[NL80211_ATTR_VENDOR_DATA]) {
1132811328
data = nla_data(info->attrs[NL80211_ATTR_VENDOR_DATA]);
1132911329
len = nla_len(info->attrs[NL80211_ATTR_VENDOR_DATA]);

0 commit comments

Comments
 (0)