aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/xfrm6_mode_beet.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2012-02-23 10:55:02 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-19 09:02:21 -0700
commitb86e173ed3f6e5f9a37215449c0cb1167d13d490 (patch)
tree7f5205c53047df5127d01f8311e6a6726ee77b48 /net/ipv6/xfrm6_mode_beet.c
parent983af6e10958557843e4b5546c96e371ee3c8ddd (diff)
downloadkernel_samsung_smdk4412-b86e173ed3f6e5f9a37215449c0cb1167d13d490.zip
kernel_samsung_smdk4412-b86e173ed3f6e5f9a37215449c0cb1167d13d490.tar.gz
kernel_samsung_smdk4412-b86e173ed3f6e5f9a37215449c0cb1167d13d490.tar.bz2
ipsec: be careful of non existing mac headers
[ Upstream commit 03606895cd98c0a628b17324fd7b5ff15db7e3cd ] Niccolo Belli reported ipsec crashes in case we handle a frame without mac header (atm in his case) Before copying mac header, better make sure it is present. Bugzilla reference: https://bugzilla.kernel.org/show_bug.cgi?id=42809 Reported-by: Niccolò Belli <darkbasic@linuxsystems.it> Tested-by: Niccolò Belli <darkbasic@linuxsystems.it> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv6/xfrm6_mode_beet.c')
-rw-r--r--net/ipv6/xfrm6_mode_beet.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 3437d7d..f37cba9 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -80,7 +80,6 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
{
struct ipv6hdr *ip6h;
- const unsigned char *old_mac;
int size = sizeof(struct ipv6hdr);
int err;
@@ -90,10 +89,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
__skb_push(skb, size);
skb_reset_network_header(skb);
-
- old_mac = skb_mac_header(skb);
- skb_set_mac_header(skb, -skb->mac_len);
- memmove(skb_mac_header(skb), old_mac, skb->mac_len);
+ skb_mac_header_rebuild(skb);
xfrm6_beet_make_header(skb);