Re: [net v3] drivers/net/wan/lapbether: Use needed_headroom instead of hard_header_len

From: Martin Schiller
Date: Wed Aug 05 2020 - 01:23:59 EST


On 2020-08-04 21:20, Xie He wrote:
On Tue, Aug 4, 2020 at 5:43 AM Martin Schiller <ms@xxxxxxxxxx> wrote:

I'm not an expert in the field, but after reading the commit message and
the previous comments, I'd say that makes sense.

Thanks!

Shouldn't this kernel panic be intercepted by a skb_cow() before the
skb_push() in lapbeth_data_transmit()?

When a skb is passing down a protocol stack for transmission, there
might be several different skb_push calls to prepend different
headers. It would be the best (in terms of performance) if we can
allocate the needed header space in advance, so that we don't need to
reallocate the skb every time a new header needs to be prepended.

Yes, I agree.

Adding skb_cow before these skb_push calls would indeed help
preventing kernel panics, but that might not be the essential issue
here, and it might also prevent us from discovering the real issue. (I
guess this is also the reason skb_cow is not included in skb_push
itself.)

Well, you are right that the panic is "useful" to discover the real
problem. But on the other hand, if it is possible to prevent a panic, I
think we should do so. Maybe with adding a warning, when skb_cow() needs
to reallocate memory.

But this is getting a little bit off topic. For this patch I can say:

LGTM.

Reviewed-by: Martin Schiller <ms@xxxxxxxxxx>