All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: socketcan@hartkopp.net
Cc: linux-can@vger.kernel.org, mkl@pengutronix.de, kuba@kernel.org
Subject: Re: [PATCH can-next v5 05/24] can: isotp: check the CAN_ISOTP_OPTS values before applying them
Date: Sat, 05 Dec 2026 01:27:18 +0000	[thread overview]
Message-ID: <179643403883.3142.4950991542041862335@kernel.org> (raw)
In-Reply-To: <20261203-getsockopt-memcg-isotp-v5-5-bbe89b3d3b71@hartkopp.net>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message of "can: isotp: check the CAN_ISOTP_OPTS
  values before applying them" says neither whether this is a fix nor…

--

can: isotp: check the CAN_ISOTP_OPTS values before applying them

This patch makes isotp_setsockopt_locked() check the broadcast flags in
the local copy of the CAN_ISOTP_OPTS values before they are copied into
so->opt. A setsockopt() call with more than one broadcast flag set is now
rejected with -EINVAL and leaves all socket options unchanged. hweight32()
is used so that more flags can later be added to ISOTP_ALL_BC_FLAGS.

> isotp_setsockopt_locked() copies the CAN_ISOTP_OPTS values into so->opt
> before it checks them. When CAN_ISOTP_SF_BROADCAST and
> CAN_ISOTP_CF_BROADCAST are set together, CAN_ISOTP_CF_BROADCAST is
> removed and the remaining options are applied, although -EINVAL is
> returned to give user feedback on the wrong configuration.

[ ... ]

> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

[Severity: Low]
Should this patch have a Fixes: tag and say whether it is meant for
stable?

Before this patch, setsockopt(CAN_ISOTP_OPTS) with both
CAN_ISOTP_SF_BROADCAST and CAN_ISOTP_CF_BROADCAST set returned -EINVAL.
By then isotp_setsockopt_locked() had already overwritten so->opt. It
had removed CF_BROADCAST and applied ext_address/rx_ext_address and
frame_txtime.

A later bind() still sees SF_BROADCAST in so->opt:

net/can/isotp.c:isotp_register_rxid() {
	/* no broadcast modes => register rx_id for FC frame reception */
	return (isotp_bc_flags(so) == 0);
}

So the rx_id registration is skipped, and getsockopt() returns the
partly applied options. Any unprivileged user can reach this.

The apply-then-fail block came from 9f39d36530e5 ("can: isotp: add
support for transmission without flow control"). That looks like the
right target:

Fixes: 9f39d36530e5 ("can: isotp: add support for transmission without flow control")

The other patches in this series say how they are classified. For
example, "can: isotp: do not send FC.OVFLW in listen mode" has Fixes:
and Cc: stable. "can: isotp: read socket options under conf_lock in
isotp_getsockopt()" states "so this is no fix".

The new check also relies on the option values being copied into a
local buffer before conf_lock is taken. That copy came with 43c973a0887d
("can: raw, isotp: copy socket options outside of lock_sock()"). The
conf_lock itself came from "can: isotp: use a private mutex instead of
lock_sock()".

If this is meant for stable, could that dependency be noted for
backporters? If it is meant only as a uAPI tightening, could the commit
message say so?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-getsockopt-memcg-isotp-v5-0-bbe89b3d3b71%40hartkopp.net

  reply	other threads:[~2026-12-05  1:27 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 11:55 [PATCH can-next v5 00/24] can: memcg accounting, CAN_ISOTP fixes and cleanups Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 01/24] can: raw: read socket options under conf_lock in raw_getsockopt() Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 02/24] can: isotp: read socket options under conf_lock in isotp_getsockopt() Oliver Hartkopp
2026-12-03 12:22   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 03/24] can: enable memcg accounting for user triggered allocations Oliver Hartkopp
2026-12-03 12:41   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 04/24] can: isotp: do not send FC.OVFLW in listen mode Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 05/24] can: isotp: check the CAN_ISOTP_OPTS values before applying them Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko [this message]
2026-12-03 11:55 ` [PATCH can-next v5 06/24] can: isotp: add the frame transmission time to the CF broadcast gap Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 07/24] can: isotp: limit the frame transmission time to the N_As/N_Ar timeout Oliver Hartkopp
2026-12-03 11:55 ` [PATCH can-next v5 08/24] can: isotp: add N_As timeout monitoring for SF/FF/CF Oliver Hartkopp
2026-12-03 14:11   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:55 ` [PATCH can-next v5 09/24] can: isotp: add N_Ar timeout monitoring for FC Oliver Hartkopp
2026-12-03 14:30   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:56 ` [PATCH can-next v5 10/24] can: isotp: check the CAN FD tx_flags in CAN_ISOTP_LL_OPTS Oliver Hartkopp
2026-12-03 14:50   ` sashiko-bot
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:56 ` [PATCH can-next v5 11/24] can: isotp: reject reserved STmin values in CAN_ISOTP_RECV_FC Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 12/24] can: isotp: ignore CAN_ISOTP_CHK_PAD_DATA without CAN_ISOTP_RX_PADDING Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 13/24] can: isotp: drop frames without N_PCI Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 14/24] can: isotp: drop FF frames with invalid length extension Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 15/24] can: isotp: check the minimum FF_DL Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 16/24] can: isotp: check the data length of the last CF Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 17/24] can: isotp: drop inline keyword, let the compiler decide Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 18/24] can: isotp: rename rx_lock as it has become state machine lock Oliver Hartkopp
2026-12-05  1:27   ` netdev-bot+sashiko
2026-12-03 11:56 ` [PATCH can-next v5 19/24] can: isotp: introduce isotp_invalid_canid() to verify proper CAN-IDs Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 20/24] can: isotp: rename variable for the required content length Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 21/24] can: isotp: rename checkpad functions returning bool values Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 22/24] can: isotp: change return type of functions to void Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 23/24] can: isotp: rename pointer in isotp_rcv() prototype Oliver Hartkopp
2026-12-03 11:56 ` [PATCH can-next v5 24/24] can: isotp: introduce CAN_ISOTP_MIN_TX_DL 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=179643403883.3142.4950991542041862335@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --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.