Re: [PATCH net v5] ieee802154: 6lowpan: validate fragment offset against datagram size
From: Alexander Aring
Date: Thu Nov 26 2026 - 14:40:39 EST
Hi,
On Tue, Nov 24, 2026 at 2:46 AM Ryan Prinz <rc4d5a@xxxxxxxxxxxxxx> wrote:
>
> A 6LoWPAN fragment carries the datagram's total size (d_size) and its
> own offset within it. lowpan_frag_queue() never checks that the
> offset, or offset plus length, fits inside d_size, and never rejects
> an empty fragment.
>
> A datagram is considered complete once enough bytes have been counted
> (fq->q.meat) toward d_size, regardless of whether those bytes actually
> form a contiguous range. So an out-of-range or empty fragment's length
> still counts toward completion, even though it doesn't belong anywhere
> in the datagram.
>
> IPv6's ip6_frag_queue() already bounds each fragment's end against
> IPV6_MAXPLEN and rejects zero-length fragments; 6LoWPAN had no
> equivalent checks.
There is a check [0] to reject d_size above IPV6_MIN_MTU (max ipv6
ressambled packet size), so checking if the offset is in d_size should
be fine and we have something equivalent here.
>
> Fixed by rejecting any fragment that is empty, or whose offset (or
> offset + length) exceeds d_size.
>
> Fixes: 7240cdec60b1 ("6lowpan: handling 6lowpan fragmentation via inet_frag api")
> Signed-off-by: Ryan Prinz <rc4d5a@xxxxxxxxxxxxxx>
Acked-by: Alexander Aring <aahringo@xxxxxxxxxx>
Thanks!
- Alex
[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/ieee802154/6lowpan/reassembly.c?h=v7.4-rc4#n302