Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95bca62f authored by Johannes Berg's avatar Johannes Berg
Browse files

nl80211: check nla_parse_nested() return values



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>
parent 188f60ab
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -10949,9 +10949,12 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
				    rem) {
			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,
					       info->extack);
			if (err)
				goto error;

			err = -EINVAL;
			if (!pat_tb[NL80211_PKTPAT_MASK] ||
			    !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -11200,8 +11203,11 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev,
			    rem) {
		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);
		if (err)
			return err;

		if (!pat_tb[NL80211_PKTPAT_MASK] ||
		    !pat_tb[NL80211_PKTPAT_PATTERN])
			return -EINVAL;