From: Oliver Hartkopp via B4 Relay <devnull+socketcan.hartkopp.net@kernel.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
"David S. Miller" <davem@davemloft.net>,
Urs Thuermann <urs.thuermann@volkswagen.de>,
Vincent Mailhol <mailhol@kernel.org>
Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
Oliver Hartkopp <socketcan@hartkopp.net>,
syzbot+5b11eccc403dd1cea9f8@syzkaller.appspotmail.com
Subject: [PATCH v3 1/3] can: bcm: fix locking for bcm_op runtime updates
Date: Thu, 19 Feb 2026 17:51:17 +0100 [thread overview]
Message-ID: <20260219-bcm_spin_lock_init-v3-1-c61026740d7b@hartkopp.net> (raw)
In-Reply-To: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net>
From: Oliver Hartkopp <socketcan@hartkopp.net>
Commit c2aba69d0c36 ("can: bcm: add locking for bcm_op runtime updates")
added a locking for some variables that can be modified at runtime when
updating the sending bcm_op with a new TX_SETUP command in bcm_tx_setup().
Usually the RX_SETUP only handles and filters incoming traffic with one
exception: When the RX_RTR_FRAME flag is set a predefined CAN frame is
sent when a specific RTR frame is received. Therefore the rx bcm_op uses
bcm_can_tx() which uses the bcm_tx_lock that was only initialized in
bcm_tx_setup(). Add the missing spin_lock_init() when allocating the
bcm_op in bcm_rx_setup() to handle the RTR case properly.
Fixes: c2aba69d0c36 ("can: bcm: add locking for bcm_op runtime updates")
Reported-by: syzbot+5b11eccc403dd1cea9f8@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-can/699466e4.a70a0220.2c38d7.00ff.GAE@google.com/
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
net/can/bcm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/can/bcm.c b/net/can/bcm.c
index b7324e9c955b..fd9fa072881e 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1174,10 +1174,11 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
/* insert new BCM operation for the given can_id */
op = kzalloc(OPSIZ, GFP_KERNEL);
if (!op)
return -ENOMEM;
+ spin_lock_init(&op->bcm_tx_lock);
op->can_id = msg_head->can_id;
op->nframes = msg_head->nframes;
op->cfsiz = CFSIZ(msg_head->flags);
op->flags = msg_head->flags;
--
2.51.0
next prev parent reply other threads:[~2026-02-19 16:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 16:51 [PATCH v3 0/3] can: bcm: add/fix locking for config updates at runtime Oliver Hartkopp via B4 Relay
2026-02-19 16:51 ` Oliver Hartkopp via B4 Relay [this message]
2026-02-19 16:51 ` [PATCH v3 2/3] can: bcm: add locking when updating filter and timer values Oliver Hartkopp via B4 Relay
2026-03-02 10:21 ` Marc Kleine-Budde
2026-03-23 9:42 ` Marc Kleine-Budde
2026-03-23 9:46 ` Oliver Hartkopp
2026-02-19 16:51 ` [PATCH v3 3/3] can: statistics: add missing atomic access in hot path Oliver Hartkopp via B4 Relay
2026-03-02 10:22 ` Marc Kleine-Budde
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=20260219-bcm_spin_lock_init-v3-1-c61026740d7b@hartkopp.net \
--to=devnull+socketcan.hartkopp.net@kernel.org \
--cc=davem@davemloft.net \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=socketcan@hartkopp.net \
--cc=syzbot+5b11eccc403dd1cea9f8@syzkaller.appspotmail.com \
--cc=urs.thuermann@volkswagen.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®