[PATCH net v4 0/2] can: j1939: the NULL session skb, split in two

From: Piyus Kedia

Date: Sun Nov 29 2026 - 22:34:35 EST


v3 was one patch doing both halves. Oleksij asked for the NULL check to
go out on its own, small, for stable, with the DPO range check following
as its own patch, so here they are as 1/2 and 2/2.

1/2 is the stable fix and carries the only Cc: stable. It is Oleksij's
own hunk, with the netdev_warn() rewrapped to fit; it says in the message
that it is only a mitigation and leaves the protocol alone, so there is no
reason to ask it for the checks that 2/2 adds.

2/2 is the protocol fix: refuse a data packet offset that is not below
session->pkt.total, abort the session so the peer is told, and complete a
receive session from offset 0. No Cc: stable.

Posted as a series rather than as two independent patches because 2/2 does
not apply without 1/2 - sent separately, the second one fails to apply for
everyone and for the bots. If you would rather have 1/2 alone first and
2/2 after it lands, say so and I will resend that way.

Measured on current net.git main with KASAN and kasan_multi_shot=1, over
one vcan pair, the same reproducer each time:

unpatched null-ptr-deref in j1939_sk_recv() in the receive softirq,
then "Kernel panic - not syncing: Fatal exception in
interrupt" - which is also why only one report prints
despite kasan_multi_shot.
1/2 only no report, no panic, and the new warning once per round
of the reproducer, so the path is still reached and is now
handled.
1/2 + 2/2 no report, no panic, the offset refused when it arrives, and
1/2's warning never fires at all - the range check stops the
NULL skb existing. The EOMA guard in 2/2 fires in that run,
so it is not speculative.

Found by AI-driven fuzzing built on top of syzkaller; every analysis was
checked by hand against the code, as each patch records. The reproducer
is not posted - it goes to anyone who asks.
Changes in v4:
- split into the stable mitigation (1/2) and the protocol fix (2/2), as
asked; 1/2 is Oleksij's hunk and credits him with Suggested-by
- 1/2 carries the KASAN report and the panic line, and says it is only a
mitigation
- 2/2 keeps the EOMA-on-a-cancelled-session guard and the deactivate on a
second out-of-range DPO, and explains why each is needed
- recipients are get_maintainer.pl for net/can/j1939/transport.c:
linux-can and the CAN maintainers, no netdev
- stable@xxxxxxxxxxxxxxx dropped from the recipient list; the Cc: stable
tag on 1/2 is the mechanism

v3: https://lore.kernel.org/all/20261124181757.638280-1-piyus@xxxxxxxxxxx/
The review:
https://lore.kernel.org/all/awxMr_bAtgqEwbrf@xxxxxxxxxxxxxx/

Piyus Kedia (2):
can: j1939: do not pass a NULL skb to the socket layer
can: j1939: reject an out-of-range data packet offset

net/can/j1939/transport.c | 55 +++++++++++++++++++++++++++++++++++----
1 file changed, 50 insertions(+), 5 deletions(-)


base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
--
2.34.1