|
@@ -8554,6 +8554,8 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
|
|
|
|
|
|
nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN],
|
|
|
rem) {
|
|
|
+ u8 *mask_pat;
|
|
|
+
|
|
|
nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
|
|
|
nla_len(pat), NULL);
|
|
|
err = -EINVAL;
|
|
@@ -8577,19 +8579,18 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
|
|
|
goto error;
|
|
|
new_triggers.patterns[i].pkt_offset = pkt_offset;
|
|
|
|
|
|
- new_triggers.patterns[i].mask =
|
|
|
- kmalloc(mask_len + pat_len, GFP_KERNEL);
|
|
|
- if (!new_triggers.patterns[i].mask) {
|
|
|
+ mask_pat = kmalloc(mask_len + pat_len, GFP_KERNEL);
|
|
|
+ if (!mask_pat) {
|
|
|
err = -ENOMEM;
|
|
|
goto error;
|
|
|
}
|
|
|
- new_triggers.patterns[i].pattern =
|
|
|
- new_triggers.patterns[i].mask + mask_len;
|
|
|
- memcpy(new_triggers.patterns[i].mask,
|
|
|
- nla_data(pat_tb[NL80211_PKTPAT_MASK]),
|
|
|
+ new_triggers.patterns[i].mask = mask_pat;
|
|
|
+ memcpy(mask_pat, nla_data(pat_tb[NL80211_PKTPAT_MASK]),
|
|
|
mask_len);
|
|
|
+ mask_pat += mask_len;
|
|
|
+ new_triggers.patterns[i].pattern = mask_pat;
|
|
|
new_triggers.patterns[i].pattern_len = pat_len;
|
|
|
- memcpy(new_triggers.patterns[i].pattern,
|
|
|
+ memcpy(mask_pat,
|
|
|
nla_data(pat_tb[NL80211_PKTPAT_PATTERN]),
|
|
|
pat_len);
|
|
|
i++;
|
|
@@ -8781,6 +8782,8 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev,
|
|
|
|
|
|
nla_for_each_nested(pat, tb[NL80211_ATTR_COALESCE_RULE_PKT_PATTERN],
|
|
|
rem) {
|
|
|
+ u8 *mask_pat;
|
|
|
+
|
|
|
nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
|
|
|
nla_len(pat), NULL);
|
|
|
if (!pat_tb[NL80211_PKTPAT_MASK] ||
|
|
@@ -8802,17 +8805,19 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev,
|
|
|
return -EINVAL;
|
|
|
new_rule->patterns[i].pkt_offset = pkt_offset;
|
|
|
|
|
|
- new_rule->patterns[i].mask =
|
|
|
- kmalloc(mask_len + pat_len, GFP_KERNEL);
|
|
|
- if (!new_rule->patterns[i].mask)
|
|
|
+ mask_pat = kmalloc(mask_len + pat_len, GFP_KERNEL);
|
|
|
+ if (!mask_pat)
|
|
|
return -ENOMEM;
|
|
|
- new_rule->patterns[i].pattern =
|
|
|
- new_rule->patterns[i].mask + mask_len;
|
|
|
- memcpy(new_rule->patterns[i].mask,
|
|
|
- nla_data(pat_tb[NL80211_PKTPAT_MASK]), mask_len);
|
|
|
+
|
|
|
+ new_rule->patterns[i].mask = mask_pat;
|
|
|
+ memcpy(mask_pat, nla_data(pat_tb[NL80211_PKTPAT_MASK]),
|
|
|
+ mask_len);
|
|
|
+
|
|
|
+ mask_pat += mask_len;
|
|
|
+ new_rule->patterns[i].pattern = mask_pat;
|
|
|
new_rule->patterns[i].pattern_len = pat_len;
|
|
|
- memcpy(new_rule->patterns[i].pattern,
|
|
|
- nla_data(pat_tb[NL80211_PKTPAT_PATTERN]), pat_len);
|
|
|
+ memcpy(mask_pat, nla_data(pat_tb[NL80211_PKTPAT_PATTERN]),
|
|
|
+ pat_len);
|
|
|
i++;
|
|
|
}
|
|
|
|