Re: [PATCH v2] ax25: fix OOB read after address header strip in ax25_rcv().
Eric Dumazet <[email protected]> Thu, 9 Apr 2026 08:29:29 -0700
| Newsgroups | gmane.linux.hams,gmane.linux.network,gmane.linux.kernel |
|---|---|
| Message-ID | <CANn89iJL9VNa=Rj579LZgD_TVuqR-hq77RS5hf0yaDzwgnUR0g@mail.gmail.com> |
On Thu, Apr 9, 2026 at 8:24 AM Ashutosh Desai <[email protected]> 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 <[email protected]> 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.