summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Bowler <nbowler@elliptictech.com>2011-11-08 12:12:45 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-09 08:55:57 -0800
commitf82c753512bfe2fb4127ee72c882924120c11de8 (patch)
tree4169d11e2952ec0ac1d5ef9ed622c6d5b0622629
parentcfa73cca0cac4e07cc963f332aead8d118707432 (diff)
downloadlwn-f82c753512bfe2fb4127ee72c882924120c11de8.tar.gz
lwn-f82c753512bfe2fb4127ee72c882924120c11de8.zip
ah: Read nexthdr value before overwriting it in ahash input callback.
[ Upstream commit b7ea81a58adc123a4e980cb0eff9eb5c144b5dc7 ] The AH4/6 ahash input callbacks read out the nexthdr field from the AH header *after* they overwrite that header. This is obviously not going to end well. Fix it up. Signed-off-by: Nick Bowler <nbowler@elliptictech.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--net/ipv4/ah4.c4
-rw-r--r--net/ipv6/ah6.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 33ca18603e3b..c7056b2e831f 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -262,12 +262,12 @@ static void ah_input_done(struct crypto_async_request *base, int err)
if (err)
goto out;
+ err = ah->nexthdr;
+
skb->network_header += ah_hlen;
memcpy(skb_network_header(skb), work_iph, ihl);
__skb_pull(skb, ah_hlen + ihl);
skb_set_transport_header(skb, -ihl);
-
- err = ah->nexthdr;
out:
kfree(AH_SKB_CB(skb)->tmp);
xfrm_input_resume(skb, err);
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index ede4d9d6cc2b..7a33aaa00227 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -464,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err)
if (err)
goto out;
+ err = ah->nexthdr;
+
skb->network_header += ah_hlen;
memcpy(skb_network_header(skb), work_iph, hdr_len);
__skb_pull(skb, ah_hlen + hdr_len);
skb_set_transport_header(skb, -hdr_len);
-
- err = ah->nexthdr;
out:
kfree(AH_SKB_CB(skb)->tmp);
xfrm_input_resume(skb, err);