aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>2015-05-11 05:31:15 -0400
committerJohannes Berg <johannes.berg@intel.com>2015-05-11 08:51:29 -0400
commit47b4e1fc4972cc43a19121bc2608a60aef3bf216 (patch)
tree30e073ff07e403ad2586784cde8bbad2d921b67a /net
parentff419b3f95ab7a97c5f72876b53f12a249dacc2a (diff)
mac80211: move WEP tailroom size check
Remove checking tailroom when adding IV as it uses only headroom, and move the check to the ICV generation that actually needs the tailroom. In other case I hit such warning and datapath don't work, when testing: - IBSS + WEP - ath9k with hw crypt enabled - IPv6 data (ping6) WARNING: CPU: 3 PID: 13301 at net/mac80211/wep.c:102 ieee80211_wep_add_iv+0x129/0x190 [mac80211]() [...] Call Trace: [<ffffffff817bf491>] dump_stack+0x45/0x57 [<ffffffff8107746a>] warn_slowpath_common+0x8a/0xc0 [<ffffffff8107755a>] warn_slowpath_null+0x1a/0x20 [<ffffffffc09ae109>] ieee80211_wep_add_iv+0x129/0x190 [mac80211] [<ffffffffc09ae7ab>] ieee80211_crypto_wep_encrypt+0x6b/0xd0 [mac80211] [<ffffffffc09d3fb1>] invoke_tx_handlers+0xc51/0xf30 [mac80211] [...] Cc: stable@vger.kernel.org Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/wep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index a4220e92f0cc..efa3f48f1ec5 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local,
98 98
99 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); 99 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
100 100
101 if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN || 101 if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
102 skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
103 return NULL; 102 return NULL;
104 103
105 hdrlen = ieee80211_hdrlen(hdr->frame_control); 104 hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -167,6 +166,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local,
167 size_t len; 166 size_t len;
168 u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; 167 u8 rc4key[3 + WLAN_KEY_LEN_WEP104];
169 168
169 if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
170 return -1;
171
170 iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); 172 iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
171 if (!iv) 173 if (!iv)
172 return -1; 174 return -1;