: Ensure IV is in linear part of the skb to avoid BUG() due to OOB access
Subsystems (3)
ESP does not account for the IV size when calling pskb_may_pull() to ensure everything it accesses directly is within the linear part of a potential fragment. This results in a BUG() being triggered when the both the IPv4 and IPv6 ESP stack is fed with an skb where the first fragment ends between the end of the esp header and the end of the IV.
This bug was found by Dirk Nehring <[email protected]> .
net/ipv4/esp4.c +1 -1
@@ -336,7 +336,7 @@struct scatterlist *asg;int err = -EINVAL ; -if (!pskb_may_pull (skb,sizeof (*esph))) +if (!pskb_may_pull (skb,sizeof (*esph) +crypto_aead_ivsize (aead))) goto out;if (elen <=0 )
net/ipv6/esp6.c +1 -1
@@ -282,7 +282,7 @@struct scatterlist *sg;struct scatterlist *asg; -if (!pskb_may_pull (skb,sizeof (*esph))) { +if (!pskb_may_pull (skb,sizeof (*esph) +crypto_aead_ivsize (aead))) { ret = -EINVAL ; goto out; }
From: Thomas Graf <[email protected]>
Date: Thu, 27 Mar 2008 23:58:42 +0100
Quoted 9 lines
ESP does not account for the IV size when calling
pskb_may_pull()to ensure everything it accesses directly is within the linear part of a potential fragment. This results in aBUG()being triggered when the both the IPv4 and IPv6 ESP stack is fed with an skb where the first fragment ends between the end of the esp header and the end of the IV.This bug was found by Dirk Nehring <[email protected]> .
Signed-off-by Thomas Graf <[email protected]>
Applied.
Thanks for not letting this fix fall through the cracks.