Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH net v4 0/2] can: j1939: the NULL session skb, split in two
@ 2026-11-30  3:34 Piyus Kedia
  2026-11-30  3:34 ` [PATCH net v4 1/2] can: j1939: do not pass a NULL skb to the socket layer Piyus Kedia
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Piyus Kedia @ 2026-11-30  3:34 UTC (permalink / raw)
  To: Robin van der Gracht, Oleksij Rempel, Oliver Hartkopp,
	Marc Kleine-Budde, linux-can
  Cc: kernel, linux-kernel, Kapil Vaswani

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@vger.kernel.org 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@iiitd.ac.in/
The review:
  https://lore.kernel.org/all/awxMr_bAtgqEwbrf@pengutronix.de/

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-30  7:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  3:34 [PATCH net v4 0/2] can: j1939: the NULL session skb, split in two Piyus Kedia
2026-11-30  3:34 ` [PATCH net v4 1/2] can: j1939: do not pass a NULL skb to the socket layer Piyus Kedia
2026-11-30  3:34 ` [PATCH net v4 2/2] can: j1939: reject an out-of-range data packet offset Piyus Kedia
2026-11-30  3:51   ` sashiko-bot
2026-11-30  7:47 ` [PATCH net v4 0/2] can: j1939: the NULL session skb, split in two Oleksij Rempel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox