Subject: Re: tunnel xmit and h.raw

From: "David S. Miller" <[email-masked]>
Date: Fri, 3 Oct 2003 08:04:44 -0700

On Fri, 3 Oct 2003 17:56:35 +0300 (EEST)
Julian Anastasov <[email-masked]> wrote:

> On Fri, 3 Oct 2003, David S. Miller wrote:
> 
> > Didn't we fix a nearly identical set of bugs in the tunnel
> > drivers just a month or two ago?
> 
> 	The same place, but this one is special: h.raw is updated
> for us on reallocation but if the skb is shared I do not know if this is
> fatal for the other skb users, we change also their h.raw. But I rely
> on your opinion, may be it is safer with this change.

Oh, I see, the code is actually not buggy as-is.  The following two
sequences are identical:

1)	skb->h.raw = skb->nh.raw;
	new_skb = skb_realloc_headroom(...);
	skb = new_skb;

2)	new_skb = skb_realloc_headroom(...);
	skb = new_skb;
	skb->h.raw = skb->nh.raw;

Because skb_realloc_headroom() keeps all the skb->*.raw pointers
in the right relative place if it allocates new data pointers or
whatever.

But the code is certainly clearer to read with your changes so I'll
add them as a code cleanup instead of a bug fix :)