Re: [PATCH] NET: fix kernel panic from no dev->hard_header_len space

David Miller
2006-08-02T00:48:18Z

From: Krzysztof Halasa <khc@pm.waw.pl>
Date: Wed, 02 Aug 2006 02:42:05 +0200

> Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> writes:
>
> > Actually, it is historical hole in design, inherited from ancient
> > times. Calling conventions of dev->hard_header() just did not allow
> > to reallocate. BTW in 2.6 it can, if it uses pskb_expand_head().
>
> Does that mean that hard_header() and then hard_start_xmit()
> can use pskb_expand_head() instead of skb_realloc_headroom()
> without restrictions?

It is definitely the case that ->hard_start_xmit() can use
pskb_expand_head(), some ethernet drivers even use it when they need
to clobber the IP and TCP headers to implement TSO and another entity
has a reference to the packet headers. Just be sure to pass
GFP_ATOMIC to it in such a context.

One example is drivers/net/tg3.c:tg3_start_xmit().