* [PATCH] ah: reload pointers to skb data after calling skb_cow_data()
@ 2011-01-11 17:13 Nicolas Dichtel
2011-01-11 22:04 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Dichtel @ 2011-01-11 17:13 UTC (permalink / raw)
To: netdev; +Cc: Steffen Klassert
[-- Attachment #1: Type: text/plain, Size: 43 bytes --]
Hi,
patch is enclosed.
Regards,
Nicolas
[-- Attachment #2: 0001-ah-reload-pointers-to-skb-data-after-calling-skb_co.patch --]
[-- Type: text/x-patch, Size: 1857 bytes --]
>From ba44ef6e00ca0f4c13e425f4a39e8749c56db843 Mon Sep 17 00:00:00 2001
From: Dang Hongwu <hongwu.dang@6wind.com>
Date: Tue, 11 Jan 2011 12:00:05 -0500
Subject: [PATCH] ah: reload pointers to skb data after calling skb_cow_data()
skb_cow_data() may allocate a new data buffer, so pointers on
skb should be set after this function.
Bug was introduced by commit dff3bb06 and 8631e9bd.
Signed-off-by: Wang Xuefu <xuefu.wang@6wind.com>
Acked-by: Krzysztof Witek <krzysztof.witek@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
net/ipv4/ah4.c | 7 ++++---
net/ipv6/ah6.c | 8 +++++---
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 880a5ec..86961be 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -314,14 +314,15 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
skb->ip_summed = CHECKSUM_NONE;
- ah = (struct ip_auth_hdr *)skb->data;
- iph = ip_hdr(skb);
- ihl = ip_hdrlen(skb);
if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
goto out;
nfrags = err;
+ ah = (struct ip_auth_hdr *)skb->data;
+ iph = ip_hdr(skb);
+ ihl = ip_hdrlen(skb);
+
work_iph = ah_alloc_tmp(ahash, nfrags, ihl + ahp->icv_trunc_len);
if (!work_iph)
goto out;
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index ee82d4e..1aba54a 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -538,14 +538,16 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
if (!pskb_may_pull(skb, ah_hlen))
goto out;
- ip6h = ipv6_hdr(skb);
-
- skb_push(skb, hdr_len);
if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
goto out;
nfrags = err;
+ ah = (struct ip_auth_hdr *)skb->data;
+ ip6h = ipv6_hdr(skb);
+
+ skb_push(skb, hdr_len);
+
work_iph = ah_alloc_tmp(ahash, nfrags, hdr_len + ahp->icv_trunc_len);
if (!work_iph)
goto out;
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ah: reload pointers to skb data after calling skb_cow_data()
2011-01-11 17:13 [PATCH] ah: reload pointers to skb data after calling skb_cow_data() Nicolas Dichtel
@ 2011-01-11 22:04 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-01-11 22:04 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev, steffen.klassert
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 11 Jan 2011 18:13:33 +0100
>>From ba44ef6e00ca0f4c13e425f4a39e8749c56db843 Mon Sep 17 00:00:00 2001
> From: Dang Hongwu <hongwu.dang@6wind.com>
> Date: Tue, 11 Jan 2011 12:00:05 -0500
> Subject: [PATCH] ah: reload pointers to skb data after calling skb_cow_data()
>
> skb_cow_data() may allocate a new data buffer, so pointers on
> skb should be set after this function.
>
> Bug was introduced by commit dff3bb06 and 8631e9bd.
>
> Signed-off-by: Wang Xuefu <xuefu.wang@6wind.com>
> Acked-by: Krzysztof Witek <krzysztof.witek@6wind.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-11 22:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11 17:13 [PATCH] ah: reload pointers to skb data after calling skb_cow_data() Nicolas Dichtel
2011-01-11 22:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).