From: sashiko-bot@kernel.org
To: "Oliver Hartkopp" <socketcan@hartkopp.net>, linux-can@vger.kernel.org
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
"Vincent Mailhol" <mailhol@kernel.org>,
"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH can-next v2] can: replace ARPHRD_CAN type checks with can_get_ml_priv()
Date: Fri, 16 Oct 2026 09:50:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-174104@kernel.org> (raw)
In-Reply-To: <20261016093525.327367-1-socketcan@hartkopp.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] can: isotp: silent bind() failure if can_rx_register() returns -ENOMEM
--
commit 95cbcd2505f7f236f0737cc7471505243facbfe5
Author: Oliver Hartkopp <socketcan@hartkopp.net>
can: replace ARPHRD_CAN type checks with can_get_ml_priv()
This commit replaces explicit ARPHRD_CAN hardware type checks with
can_get_ml_priv() to prevent NULL pointer dereferences when a TUN/TAP
device is repurposed to mimic a CAN device.
Link: https://patch.msgid.link/20261012164802.94113-1-socketcan@hartkopp.net
> diff --git a/net/can/isotp.c b/net/can/isotp.c
> index f5dc9d04bd686..6c28802c0605f 100644
> --- a/net/can/isotp.c
> +++ b/net/can/isotp.c
> @@ -1610,7 +1611,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr_unsized *uaddr, int l
> err = -ENODEV;
> goto out;
> }
> - if (dev->type != ARPHRD_CAN) {
> + if (!can_get_ml_priv(dev)) {
> err = -ENODEV;
> goto out_put_dev;
> }
[Severity: Medium]
A few lines lower in isotp_bind(), the return values of can_rx_register()
are ignored:
if (isotp_register_rxid(so))
can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id),
isotp_rcv, sk, "isotp", sk);
/* no consecutive frame echo skb in flight */
WRITE_ONCE(so->cfecho, 0);
/* register for echo skb's */
can_rx_register(net, dev, tx_id, SINGLE_MASK(tx_id),
isotp_rcv_echo, sk, "isotpe", sk);
If can_rx_register() fails (for example, returning -ENOMEM due to a failed
kmem_cache_alloc()), bind() will succeed but the socket is not fully
registered to receive CAN frames. This leads to a silent failure where
user-space believes the socket is successfully bound, but no traffic will
ever be received.
Could this regression be prevented by checking the return values and
propagating the error appropriately, or cleaning up any partial
registrations?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016093525.327367-1-socketcan@hartkopp.net?part=1
next prev parent reply other threads:[~2026-10-16 9:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 9:35 [PATCH can-next v2] can: replace ARPHRD_CAN type checks with can_get_ml_priv() Oliver Hartkopp
2026-10-16 9:50 ` sashiko-bot [this message]
2026-10-16 10:02 ` Oliver Hartkopp
2026-10-16 12:15 ` Marc Kleine-Budde
2026-10-16 12:40 ` Oliver Hartkopp
2026-10-16 11:55 ` Marc Kleine-Budde
2026-10-16 12:12 ` Oliver Hartkopp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-174104@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.