: esp: fix skb_tail_pointer conversion bug
Subsystems (3)
[XFRM]: esp: fix skb_tail_pointer conversion bug
Fix incorrect switch of "trailer" skb by "skb" during skb_tail_pointer conversion:
- *(u8*)(trailer->tail - 1) = top_iph->protocol;
+ *(skb_tail_pointer(skb) - 1) = top_iph->protocol;
- *(u8 *)(trailer->tail - 1) = *skb_network_header(skb);
+ *(skb_tail_pointer(skb) - 1) = *skb_network_header(skb);
---
commit c43f271709475c491e425086b8c4a166ae4f3478
tree d9a52c51bd4a03f7d7f7930a25d8fc38d96db8e5
parent 5b83c3481951802b1fa171718e022565d78185a7
author Patrick McHardy <[email protected]> Sun, 08 Apr 2007 08:07:01 +0200 committer Patrick McHardy <[email protected]> Sun, 08 Apr 2007 08:07:01 +0200
net/ipv4/esp4.c | 2 +- net/ipv6/esp6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/esp4.c +1 -1
@@ -64,7 +64,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) esph = (struct ip_esp_hdr *)(skb_network_header (skb) + top_iph->ihl *4 ); top_iph->tot_len =htons (skb->len + alen); - *(skb_tail_pointer (skb) -1 ) = top_iph->protocol; + *(skb_tail_pointer (trailer) -1 ) = top_iph->protocol;/* this is non-NULL only with UDP Encapsulation */ if (x->encap) {
net/ipv6/esp6.c +1 -1
@@ -91,7 +91,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) top_iph = (struct ipv6hdr *)__skb_push (skb, hdr_len); esph = (struct ipv6_esp_hdr *)skb_transport_header (skb); top_iph->payload_len =htons (skb->len + alen -sizeof (*top_iph)); - *(skb_tail_pointer (skb) -1 ) = *skb_network_header (skb); + *(skb_tail_pointer (trailer) -1 ) = *skb_network_header (skb); *skb_network_header (skb) =IPPROTO_ESP ; esph->spi = x->id.spi;
Quoted 13 lines · Patrick McHardy
[XFRM]: esp: fix
skb_tail_pointerconversion bugFix incorrect switch of "trailer" skb by "skb" during
skb_tail_pointerconversion:(quoted diff) +2
-2- *(u8*)(trailer->tail - 1) = top_iph->protocol; + *(skb_tail_pointer(skb) - 1) = top_iph->protocol; - *(u8 *)(trailer->tail - 1) = *skb_network_header(skb); + *(skb_tail_pointer(skb) - 1) = *skb_network_header(skb);
Quoted 1 line
Signed-off-by Patrick McHardy <[email protected]>
Thanks Patrick, for this one and the other fixes for the offset conversion.
- Arnaldo
From: "Arnaldo Carvalho de Melo" <[email protected]>
Date: Sun, 8 Apr 2007 10:07:29 -0300
Quoted 10 lines · Patrick McHardy
Quoted 9 lines
[XFRM]: esp: fix
skb_tail_pointerconversion bugFix incorrect switch of "trailer" skb by "skb" during
skb_tail_pointerconversion:(quoted diff) +1
-1- *(u8*)(trailer->tail - 1) = top_iph->protocol; + *(skb_tail_pointer(skb) - 1) = top_iph->protocol;
Quoted 7 lines
Quoted 5 lines
(quoted diff) +1
-1- *(u8 *)(trailer->tail - 1) = *skb_network_header(skb); + *(skb_tail_pointer(skb) - 1) = *skb_network_header(skb);Signed-off-by Patrick McHardy <[email protected]>Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
Applied, thanks everyone.