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

Commit d7ea3be5 authored by Brandon Craig Rhodes's avatar Brandon Craig Rhodes Committed by John W. Linville
Browse files

[PATCH] hostap: Allocate enough tailroom for TKIP



When hostap_tx_encrypt() tries to allocate enough headroom and
tailroom for ieee80211 encryption, it only makes enough room for the
"mpdu" phase of the operation, but forgets about the "msdu" phase.
(For TKIP, these two phases require, respectively, 4 and 8 bytes of
tailroom, per the "ieee80211_crypt_tkip" structure at the bottom of
net/ieee80211/ieee80211_crypt_tkip.c.)

Signed-off-by: default avatarBrandon Craig Rhodes <brandon@rhodesmill.org>
Signed-off-by: default avatarJouni Malinen <j@w1.fi>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ef7ab235
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -311,7 +311,7 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
	local_info_t *local;
	struct ieee80211_hdr_4addr *hdr;
	u16 fc;
	int hdr_len, res;
	int prefix_len, postfix_len, hdr_len, res;

	iface = netdev_priv(skb->dev);
	local = iface->local;
@@ -337,10 +337,13 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
	if (skb == NULL)
		return NULL;

	if ((skb_headroom(skb) < crypt->ops->extra_mpdu_prefix_len ||
	     skb_tailroom(skb) < crypt->ops->extra_mpdu_postfix_len) &&
	    pskb_expand_head(skb, crypt->ops->extra_mpdu_prefix_len,
			     crypt->ops->extra_mpdu_postfix_len, GFP_ATOMIC)) {
	prefix_len = crypt->ops->extra_mpdu_prefix_len +
		crypt->ops->extra_msdu_prefix_len;
	postfix_len = crypt->ops->extra_mpdu_postfix_len +
		crypt->ops->extra_msdu_postfix_len;
	if ((skb_headroom(skb) < prefix_len ||
	     skb_tailroom(skb) < postfix_len) &&
	    pskb_expand_head(skb, prefix_len, postfix_len, GFP_ATOMIC)) {
		kfree_skb(skb);
		return NULL;
	}