aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-07-30 08:55:26 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-09-03 05:13:14 -0400
commitbd8c78e78d5011d8111bc2533ee73b13a3bd6c42 (patch)
tree9b4c5e04fe46ab3c7287620e1d356cb0ab68eb04 /net/wireless
parent14b058bbce9279ee432f0944ca14df69f4a0d170 (diff)
nl80211: clear skb cb before passing to netlink
In testmode and vendor command reply/event SKBs we use the skb cb data to store nl80211 parameters between allocation and sending. This causes the code for CONFIG_NETLINK_MMAP to get confused, because it takes ownership of the skb cb data when the SKB is handed off to netlink, and it doesn't explicitly clear it. Clear the skb cb explicitly when we're done and before it gets passed to netlink to avoid this issue. Cc: stable@vger.kernel.org [this goes way back] Reported-by: Assaf Azulay <assaf.azulay@intel.com> Reported-by: David Spinadel <david.spinadel@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index df7b1332a1ec..7257164af91b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6969,6 +6969,9 @@ void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp)
6969 struct nlattr *data = ((void **)skb->cb)[2]; 6969 struct nlattr *data = ((void **)skb->cb)[2];
6970 enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; 6970 enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE;
6971 6971
6972 /* clear CB data for netlink core to own from now on */
6973 memset(skb->cb, 0, sizeof(skb->cb));
6974
6972 nla_nest_end(skb, data); 6975 nla_nest_end(skb, data);
6973 genlmsg_end(skb, hdr); 6976 genlmsg_end(skb, hdr);
6974 6977
@@ -9294,6 +9297,9 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb)
9294 void *hdr = ((void **)skb->cb)[1]; 9297 void *hdr = ((void **)skb->cb)[1];
9295 struct nlattr *data = ((void **)skb->cb)[2]; 9298 struct nlattr *data = ((void **)skb->cb)[2];
9296 9299
9300 /* clear CB data for netlink core to own from now on */
9301 memset(skb->cb, 0, sizeof(skb->cb));
9302
9297 if (WARN_ON(!rdev->cur_cmd_info)) { 9303 if (WARN_ON(!rdev->cur_cmd_info)) {
9298 kfree_skb(skb); 9304 kfree_skb(skb);
9299 return -EINVAL; 9305 return -EINVAL;