Commit f82c7535 authored by Nick Bowler's avatar Nick Bowler Committed by Greg Kroah-Hartman

ah: Read nexthdr value before overwriting it in ahash input callback.

[ Upstream commit b7ea81a5 ]

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: default avatarNick Bowler <nbowler@elliptictech.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cfa73cca
...@@ -262,12 +262,12 @@ static void ah_input_done(struct crypto_async_request *base, int err) ...@@ -262,12 +262,12 @@ static void ah_input_done(struct crypto_async_request *base, int err)
if (err) if (err)
goto out; goto out;
err = ah->nexthdr;
skb->network_header += ah_hlen; skb->network_header += ah_hlen;
memcpy(skb_network_header(skb), work_iph, ihl); memcpy(skb_network_header(skb), work_iph, ihl);
__skb_pull(skb, ah_hlen + ihl); __skb_pull(skb, ah_hlen + ihl);
skb_set_transport_header(skb, -ihl); skb_set_transport_header(skb, -ihl);
err = ah->nexthdr;
out: out:
kfree(AH_SKB_CB(skb)->tmp); kfree(AH_SKB_CB(skb)->tmp);
xfrm_input_resume(skb, err); xfrm_input_resume(skb, err);
......
...@@ -464,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err) ...@@ -464,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err)
if (err) if (err)
goto out; goto out;
err = ah->nexthdr;
skb->network_header += ah_hlen; skb->network_header += ah_hlen;
memcpy(skb_network_header(skb), work_iph, hdr_len); memcpy(skb_network_header(skb), work_iph, hdr_len);
__skb_pull(skb, ah_hlen + hdr_len); __skb_pull(skb, ah_hlen + hdr_len);
skb_set_transport_header(skb, -hdr_len); skb_set_transport_header(skb, -hdr_len);
err = ah->nexthdr;
out: out:
kfree(AH_SKB_CB(skb)->tmp); kfree(AH_SKB_CB(skb)->tmp);
xfrm_input_resume(skb, err); xfrm_input_resume(skb, err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment