aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Xu2017-10-03 15:21:51 -0500
committerGreg Kroah-Hartman2017-10-18 02:20:41 -0500
commit6a6c61d8467d2dd7059b7d52773c18f8122e4f68 (patch)
tree377c73077fbccaf0a7d7136b1e4b2158e3ca3957
parentf2bb4bcc041194d655e41a4fb24789f3966755c3 (diff)
downloadti-linux-kernel-6a6c61d8467d2dd7059b7d52773c18f8122e4f68.tar.gz
ti-linux-kernel-6a6c61d8467d2dd7059b7d52773c18f8122e4f68.tar.xz
ti-linux-kernel-6a6c61d8467d2dd7059b7d52773c18f8122e4f68.zip
nl80211: Define policy for packet pattern attributes
commit ad670233c9e1d5feb365d870e30083ef1b889177 upstream. Define a policy for packet pattern attributes in order to fix a potential read over the end of the buffer during nla_get_u32() of the NL80211_PKTPAT_OFFSET attribute. Note that the data there can always be read due to SKB allocation (with alignment and struct skb_shared_info at the end), but the data might be uninitialized. This could be used to leak some data from uninitialized vmalloc() memory, but most drivers don't allow an offset (so you'd just get -EINVAL if the data is non-zero) or just allow it with a fixed value - 100 or 128 bytes, so anything above that would get -EINVAL. With brcmfmac the limit is 1500 so (at least) one byte could be obtained. Cc: stable@kernel.org Signed-off-by: Peng Xu <pxu@qti.qualcomm.com> Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> [rewrite description based on SKB allocation knowledge] Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/wireless/nl80211.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8ece212aa3d2..7950506395a8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -485,6 +485,14 @@ nl80211_plan_policy[NL80211_SCHED_SCAN_PLAN_MAX + 1] = {
485 [NL80211_SCHED_SCAN_PLAN_ITERATIONS] = { .type = NLA_U32 }, 485 [NL80211_SCHED_SCAN_PLAN_ITERATIONS] = { .type = NLA_U32 },
486}; 486};
487 487
488/* policy for packet pattern attributes */
489static const struct nla_policy
490nl80211_packet_pattern_policy[MAX_NL80211_PKTPAT + 1] = {
491 [NL80211_PKTPAT_MASK] = { .type = NLA_BINARY, },
492 [NL80211_PKTPAT_PATTERN] = { .type = NLA_BINARY, },
493 [NL80211_PKTPAT_OFFSET] = { .type = NLA_U32 },
494};
495
488static int nl80211_prepare_wdev_dump(struct sk_buff *skb, 496static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
489 struct netlink_callback *cb, 497 struct netlink_callback *cb,
490 struct cfg80211_registered_device **rdev, 498 struct cfg80211_registered_device **rdev,
@@ -9410,7 +9418,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
9410 u8 *mask_pat; 9418 u8 *mask_pat;
9411 9419
9412 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat), 9420 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
9413 nla_len(pat), NULL); 9421 nla_len(pat), nl80211_packet_pattern_policy);
9414 err = -EINVAL; 9422 err = -EINVAL;
9415 if (!pat_tb[NL80211_PKTPAT_MASK] || 9423 if (!pat_tb[NL80211_PKTPAT_MASK] ||
9416 !pat_tb[NL80211_PKTPAT_PATTERN]) 9424 !pat_tb[NL80211_PKTPAT_PATTERN])
@@ -9660,7 +9668,7 @@ static int nl80211_parse_coalesce_rule(struct cfg80211_registered_device *rdev,
9660 u8 *mask_pat; 9668 u8 *mask_pat;
9661 9669
9662 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat), 9670 nla_parse(pat_tb, MAX_NL80211_PKTPAT, nla_data(pat),
9663 nla_len(pat), NULL); 9671 nla_len(pat), nl80211_packet_pattern_policy);
9664 if (!pat_tb[NL80211_PKTPAT_MASK] || 9672 if (!pat_tb[NL80211_PKTPAT_MASK] ||
9665 !pat_tb[NL80211_PKTPAT_PATTERN]) 9673 !pat_tb[NL80211_PKTPAT_PATTERN])
9666 return -EINVAL; 9674 return -EINVAL;