Re: [PATCH v2] ax25: fix OOB read after address header strip in ax25_rcv().
From: Eric Dumazet
Date: Thu Apr 09 2026 - 11:38:11 EST
On Thu, Apr 9, 2026 at 8:24 AM Ashutosh Desai
<ashutoshdesai993@xxxxxxxxx> wrote:
>
> ax25_rcv() calls skb_pull(skb, ax25_addr_size(&dp)) to strip the
> address header, then reads skb->data[0] (control byte) and skb->data[1]
> (PID byte) without verifying those bytes are in the linear sk_buff area.
>
> The original fix checked skb->len < 2, but as Eric Dumazet pointed out,
> skb->len counts bytes across the linear head and any non-linear
> fragments. If the two bytes needed sit in a fragment, the check passes
> but the direct skb->data access is still out of bounds.
>
> Use pskb_may_pull(skb, 2) instead, which ensures both bytes are present
> and pulls them into the linear area if needed before we read them.
>
> Suggested-by: Eric Dumazet <edumazet@xxxxxxxxxx>
I have not suggested to fix a bug in ax25.
I added a comment on your initial version.
A "Suggested-by" would imply I made the initial discovery.
Please carefully read Documentation/process/maintainer-netdev.rst
We require a 24-hour delay between each version.