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

From: Xie He
Date: Sat Aug 01 2020 - 20:58:52 EST


On Sat, Aug 1, 2020 at 6:31 AM Willem de Bruijn
<willemdebruijn.kernel@xxxxxxxxx> wrote:
>
> The kernel interface cannot be changed. If packet sockets used to pass
> the first byte up to userspace, they have to continue to do so.
>
> So I think you can limit the header_ops to only dev_hard_header.

Actually if we want to keep the kernel interface unchanged, we
shouldn't implement header_ops for dev_hard_header either, because
this changes the way the user space program sends DGRAM packets, too.
Before the change the userspace program needs to add the 1-byte header
before sending, and after the change the userspace program will let
the kernel add the header via dev_hard_header.

> Fixes should be small and targeted. Any larger refactoring is
> best addressed in a separate net-next patch.

I guess the best way for this fix patch would be just add a 0-byte
packet check before the driver reads skb->data[0].

Thanks! I'll add the check and re-send the patch.