Commit d4857eb7 authored by Johannes Berg's avatar Johannes Berg Committed by Greg Kroah-Hartman

nl80211: check nla_parse_nested() return values

[ Upstream commit 95bca62f ]

At the very least we should check the return value if
nla_parse_nested() is called with a non-NULL policy.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 334c9cd8
...@@ -10529,9 +10529,12 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) ...@@ -10529,9 +10529,12 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
rem) { rem) {
u8 *mask_pat; u8 *mask_pat;
nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
nl80211_packet_pattern_policy, nl80211_packet_pattern_policy,
info->extack); info->extack);
if (err)
goto error;
err = -EINVAL; err = -EINVAL;
if (!pat_tb[NL80211_PKTPAT_MASK] || if (!pat_tb[NL80211_PKTPAT_MASK] ||
!pat_tb[NL80211_PKTPAT_PATTERN]) !pat_tb[NL80211_PKTPAT_PATTERN])
...@@ -10780,8 +10783,11 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev, ...@@ -10780,8 +10783,11 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev,
rem) { rem) {
u8 *mask_pat; u8 *mask_pat;
nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat, err = nla_parse_nested(pat_tb, MAX_NL80211_PKTPAT, pat,
nl80211_packet_pattern_policy, NULL); nl80211_packet_pattern_policy, NULL);
if (err)
return err;
if (!pat_tb[NL80211_PKTPAT_MASK] || if (!pat_tb[NL80211_PKTPAT_MASK] ||
!pat_tb[NL80211_PKTPAT_PATTERN]) !pat_tb[NL80211_PKTPAT_PATTERN])
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment