netdev
[Top] [All Lists]

Re: tunnel xmit and h.raw

To: Julian Anastasov <ja@xxxxxx>
Subject: Re: tunnel xmit and h.raw
From: "David S. Miller" <davem@xxxxxxxxxx>
Date: Fri, 3 Oct 2003 08:04:44 -0700
Cc: netdev@xxxxxxxxxxx
In-reply-to: <Pine.LNX.4.44.0310031750390.2761-100000@l>
References: <20031003073039.7ca1a76c.davem@redhat.com> <Pine.LNX.4.44.0310031750390.2761-100000@l>
Sender: netdev-bounce@xxxxxxxxxxx
On Fri, 3 Oct 2003 17:56:35 +0300 (EEST)
Julian Anastasov <ja@xxxxxx> 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 :)


<Prev in Thread] Current Thread [Next in Thread>