From nobody Fri Apr 3 09:50:41 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07AA134CFAE; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519909; cv=none; b=AEqlmUs0CdhHeuxR5sWONxMzmZqb1fHNOQjMtyoTBvSuwZvNWHxCr3fW3dJm8Umhx+xakYSBATgkr2De9P5XZHLIe8hOWS3JiIVJxNGKEmtlo2MnXmuwipiUxDrYoa97KDkunBR9GWgxiqSDPv+/0HzLWC03ez24PMS35fY/5o8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519909; c=relaxed/simple; bh=Ndj7MZu1RYgFXaRQMR5Ww5AM02i+hNiCGZqxPAQvqAw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TgjcwGR+nglWtAVDGRZsJegj/qQp9PDXidgRNRYRoV+N2eEpy0G0AFSGA9y/W0aovg5Vk9oJGSUzWD6MDICktpCa6ASQrrvMsm7Hh5Bw4wSII1TUYjcTu7Ui7vYEn7c4ZGumeGNtB7PL4jLxGYqS4DIsxSwd6cz3TVbhWkkcGro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WIAEoh8N; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WIAEoh8N" Received: by smtp.kernel.org (Postfix) with ESMTPS id B4883C19421; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771519908; bh=Ndj7MZu1RYgFXaRQMR5Ww5AM02i+hNiCGZqxPAQvqAw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=WIAEoh8NKt64kCCMP6Kuru4FIahCUMvNgqddpu9JRwdatalVOjE+QXKfW2uu17baS oXBpJOpWVhvvI4pjnOTk7rHT8mPqDMS++3JFMXPx2UfFoZMCVzmV1yWn4EnDa0vE3h U/KzBvX8+So47N8SjQOpcD8dZ2PDrsiR9NG33xPP2qMbQGmYfmCQgqnBFyfxSC3bPv 3vpBprX0UKifMCAsoQ/g4AH4iTnCQ+Gokp/IKRYM4AQR4eKsi/1fIzigQzB9YCKgsI jA6LLCb1wRHIbh/RYZkvdCP3pRapADgSEbKqYF5m0l/MY1WMm8PwRAGTIlc6LgtxjV 2C55cqc7gsiUw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A365CE9A051; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) From: Oliver Hartkopp via B4 Relay Date: Thu, 19 Feb 2026 17:51:17 +0100 Subject: [PATCH v3 1/3] can: bcm: fix locking for bcm_op runtime updates Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260219-bcm_spin_lock_init-v3-1-c61026740d7b@hartkopp.net> References: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net> In-Reply-To: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net> To: Marc Kleine-Budde , "David S. Miller" , Urs Thuermann , Vincent Mailhol Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Hartkopp , syzbot+5b11eccc403dd1cea9f8@syzkaller.appspotmail.com X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=ed25519-sha256; t=1771519907; l=1553; i=socketcan@hartkopp.net; s=20260128; h=from:subject:message-id; bh=XQu0DK6j8SlJ077Pj9O4qw1EtV49i3xT6l7+T5PUHaM=; b=ZffYcnzmkUyzxhttrdkJTF2yjTZSj9Njia7OwlRQeUSeM3XgkMKXvfl1kgQyd2XB3IRSXsq1z wcmIzFCjZJ7DX2uQiXhgyyVgMamm1kMxu0OSplfq4H9e/hXa9QRtVAx X-Developer-Key: i=socketcan@hartkopp.net; a=ed25519; pk=/gU/7/wBqak3kTsTeFbCCqUi9dnh+1i6ITEkfPj/BvU= X-Endpoint-Received: by B4 Relay for socketcan@hartkopp.net/20260128 with auth_id=620 X-Original-From: Oliver Hartkopp Reply-To: socketcan@hartkopp.net From: Oliver Hartkopp 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 --- 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_he= ad, struct msghdr *msg, /* insert new BCM operation for the given can_id */ op =3D kzalloc(OPSIZ, GFP_KERNEL); if (!op) return -ENOMEM; =20 + spin_lock_init(&op->bcm_tx_lock); op->can_id =3D msg_head->can_id; op->nframes =3D msg_head->nframes; op->cfsiz =3D CFSIZ(msg_head->flags); op->flags =3D msg_head->flags; =20 --=20 2.51.0 From nobody Fri Apr 3 09:50:41 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07996346AF8; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519909; cv=none; b=H4vJp0smpBiy3NoRAvGwC8+J/ciFmKM23WppDfA5lf061saIEQ6KbdwZptagwTTZy7zPI0P3FotsReLGQZGHo2KYhu3S8j8dT2lUoDuTJgooQ+yPNh+9K7mTJNb3cpFSdNrSOyVv52++VfDCBLO+qaYYR+s8iUJY1n6KIpvwJLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519909; c=relaxed/simple; bh=mZYbmW+dvJay6yLP96rk2aVfcPCWb/vWObzqfGu6ioA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WCtzhNZT0zjLukxzUJ2oJw1/BiyO5b6L3Bi7IhuU4rJf+6JvVqvnEFpN2AAxI3iJTU4SVhY7rvVTHTrNN2x0ugLrZnZTCtdLn/BbAvc4qgh9ZP/EjNSQYfTtBddgMYYPrUi8PKckxIEG6ryu+C+aaXN1jSp9sy2qxLKYGbS5378= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WtuLLAAu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WtuLLAAu" Received: by smtp.kernel.org (Postfix) with ESMTPS id BF73FC19423; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771519908; bh=mZYbmW+dvJay6yLP96rk2aVfcPCWb/vWObzqfGu6ioA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=WtuLLAAu6nl4m/fTPxwfSnW5SVCD1TnDe64ZP89KSSOVEfIJ82XsGYIT5/exrss4F FCdSUhxtvafv0mwAUNSJ9embrefN+Fc8g7h/AyghJvGMwiJxwUXo3LVu1oILBcrT8H 7tgmvJKk6VeYA7HWQu2M9RmoseKkpOeBcc4ge6InGbGu02lZL9hevGdO7G37hhoACx FfVa9u3QPxFUffgmS/iY4i9eAD/BDViWFM0E1vC+i3RGpuHd8K+HwKitc+bNXqJIOB m/5Bd5d7t420X3/wMcPiyTHvXRWgwwo0I324ORpgzRVWoH52HW+mZwadil1aQq/RO7 DcnXECzHYkWew== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B28B4E9A052; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) From: Oliver Hartkopp via B4 Relay Date: Thu, 19 Feb 2026 17:51:18 +0100 Subject: [PATCH v3 2/3] can: bcm: add locking when updating filter and timer values Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260219-bcm_spin_lock_init-v3-2-c61026740d7b@hartkopp.net> References: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net> In-Reply-To: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net> To: Marc Kleine-Budde , "David S. Miller" , Urs Thuermann , Vincent Mailhol Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Hartkopp , syzbot+75e5e4ae00c3b4bb544e@syzkaller.appspotmail.com X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=ed25519-sha256; t=1771519907; l=4358; i=socketcan@hartkopp.net; s=20260128; h=from:subject:message-id; bh=LZlNTIGHLDqDPxLmvSsyaQormiMZ6P6MsnwA3/m9nxY=; b=P69G1IdzhnQblRhC+Bgu/Rt1k2fgv4BZnLLWj8gfBvttZens7GwCb3V5SZi36zAVQc95rYonJ 3A9ym3fzKkLCwWuGz43/FWDfqdpIGXDonV1CC4XBYxMGE8+GKiNMxVY X-Developer-Key: i=socketcan@hartkopp.net; a=ed25519; pk=/gU/7/wBqak3kTsTeFbCCqUi9dnh+1i6ITEkfPj/BvU= X-Endpoint-Received: by B4 Relay for socketcan@hartkopp.net/20260128 with auth_id=620 X-Original-From: Oliver Hartkopp Reply-To: socketcan@hartkopp.net From: Oliver Hartkopp KCSAN detected a simultaneous access to timer values that can be overwritten in bcm_rx_setup when updating timer and filter content. This caused no functional issues in the past as the new values might show up at any time without losing its intended functionality. Btw. the KCSAN report can be resolved by protecting the 'lockless' data updates with a spin_lock_bh(). Fixes: ffd980f976e7 ("[CAN]: Add broadcast manager (bcm) protocol") Reported-by: syzbot+75e5e4ae00c3b4bb544e@syzkaller.appspotmail.com Closes: https://lore.kernel.org/linux-can/6975d5cf.a00a0220.33ccc7.0022.GAE= @google.com/ Signed-off-by: Oliver Hartkopp --- net/can/bcm.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/net/can/bcm.c b/net/can/bcm.c index fd9fa072881e..0a3dc5500e14 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -123,10 +123,11 @@ struct bcm_op { struct canfd_frame sframe; struct canfd_frame last_sframe; struct sock *sk; struct net_device *rx_reg_dev; spinlock_t bcm_tx_lock; /* protect currframe/count in runtime updates */ + spinlock_t bcm_rx_update_lock; /* protect update of filter data */ }; =20 struct bcm_sock { struct sock sk; int bound; @@ -1141,10 +1142,12 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_he= ad, struct msghdr *msg, return -EINVAL; =20 /* check the given can_id */ op =3D bcm_find_op(&bo->rx_ops, msg_head, ifindex); if (op) { + void *new_frames =3D NULL; + /* update existing BCM operation */ =20 /* * Do we need more space for the CAN frames than currently * allocated? -> This is a _really_ unusual use-case and @@ -1152,33 +1155,53 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_he= ad, struct msghdr *msg, */ if (msg_head->nframes > op->nframes) return -E2BIG; =20 if (msg_head->nframes) { - /* update CAN frames content */ - err =3D memcpy_from_msg(op->frames, msg, + /* get new CAN frames content before locking */ + new_frames =3D kmalloc(msg_head->nframes * op->cfsiz, + GFP_KERNEL); + if (!new_frames) + return -ENOMEM; + + err =3D memcpy_from_msg(new_frames, msg, msg_head->nframes * op->cfsiz); - if (err < 0) + if (err < 0) { + kfree(new_frames); return err; - - /* clear last_frames to indicate 'nothing received' */ - memset(op->last_frames, 0, msg_head->nframes * op->cfsiz); + } } =20 + spin_lock_bh(&op->bcm_rx_update_lock); op->nframes =3D msg_head->nframes; op->flags =3D msg_head->flags; =20 + if (msg_head->nframes) { + /* update CAN frames content */ + memcpy(op->frames, new_frames, + msg_head->nframes * op->cfsiz); + + /* clear last_frames to indicate 'nothing received' */ + memset(op->last_frames, 0, + msg_head->nframes * op->cfsiz); + } + spin_unlock_bh(&op->bcm_rx_update_lock); + + /* free temporary frames / kfree(NULL) is safe */ + kfree(new_frames); + /* Only an update -> do not call can_rx_register() */ do_rx_register =3D 0; =20 } else { /* insert new BCM operation for the given can_id */ op =3D kzalloc(OPSIZ, GFP_KERNEL); if (!op) return -ENOMEM; =20 spin_lock_init(&op->bcm_tx_lock); + spin_lock_init(&op->bcm_rx_update_lock); op->can_id =3D msg_head->can_id; op->nframes =3D msg_head->nframes; op->cfsiz =3D CFSIZ(msg_head->flags); op->flags =3D msg_head->flags; =20 @@ -1261,24 +1284,26 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_he= ad, struct msghdr *msg, =20 } else { if (op->flags & SETTIMER) { =20 /* set timer value */ + spin_lock_bh(&op->bcm_rx_update_lock); op->ival1 =3D msg_head->ival1; op->ival2 =3D msg_head->ival2; op->kt_ival1 =3D bcm_timeval_to_ktime(msg_head->ival1); op->kt_ival2 =3D bcm_timeval_to_ktime(msg_head->ival2); + op->kt_lastmsg =3D 0; + spin_unlock_bh(&op->bcm_rx_update_lock); =20 /* disable an active timer due to zero value? */ if (!op->kt_ival1) hrtimer_cancel(&op->timer); =20 /* * In any case cancel the throttle timer, flush * potentially blocked msgs and reset throttle handling */ - op->kt_lastmsg =3D 0; hrtimer_cancel(&op->thrtimer); bcm_rx_thr_flush(op); } =20 if ((op->flags & STARTTIMER) && op->kt_ival1) --=20 2.51.0 From nobody Fri Apr 3 09:50:41 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07B5134CFB7; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519909; cv=none; b=T2TI4eTNDABW5727ntw8VeFzheE0uwK3QYbwEwW1XzYpn9J6l794UsCd/r3Xc4ygtSVUAO7uSibel1Ng32K9pcvYNAlLcC2R2R3hM6YlElvbW19MGbYUnO8HhDX2nYpm2ZxWqB9gZnPDxxpIrJjcrn7ko5asqN+67DJ6LtVgyW8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771519909; c=relaxed/simple; bh=Uk2s+vOYK5R2mgNSWbZlvpy2x63Rk1TzbDHp24TGokg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HXsJa16BGIno3GWtOsyhpVyeNvh4n0tqAgi6rDfDd/K/s6OMWaAe0YayzcjyVv5kBzjWT100jCXy62dfv6wdWbAMN1dX6cnYqxWRAIf497uzIf/AayqBzjQNC1FbcwW8JkfEZzl+mb2HmGI71w2PZT4h2jbUqg7m+vpLik6Cv58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DFkRFBw6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DFkRFBw6" Received: by smtp.kernel.org (Postfix) with ESMTPS id CD68EC2BC86; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771519908; bh=Uk2s+vOYK5R2mgNSWbZlvpy2x63Rk1TzbDHp24TGokg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=DFkRFBw6l55/GlYG6JDk22DmNWf6NVPgVWn10YAc19Nv1eUGiStiznbF58+R0z8Nt U9iVbdT1HmBdUbfUE84ZAThM9c8aAe9UTV3KBb9ckRURuvuxuJhavbwmEpeeUkypPs +O0anVh4EWgaFRcxN1oN9/KG/kzwkEYgC/3WQLfBGbGrEbDW6FcfBWjqlhLNO9Gqz4 m6FA3Ht9DtP1x0Pn2MLakDZUdjd1x+4ubdpTVpa+/lWQkB4rq8WUtcSdAlsVJ1LJsA 0rBk3xQ0w2nO3b6jb7rW06X6MHAfvYS4EWFN+bdE3N0iiAoZtaL6WXfYLM4v0hwZKu SZzZLDJ6t5/iQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C271AE9A04E; Thu, 19 Feb 2026 16:51:48 +0000 (UTC) From: Oliver Hartkopp via B4 Relay Date: Thu, 19 Feb 2026 17:51:19 +0100 Subject: [PATCH v3 3/3] can: statistics: add missing atomic access in hot path Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260219-bcm_spin_lock_init-v3-3-c61026740d7b@hartkopp.net> References: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net> In-Reply-To: <20260219-bcm_spin_lock_init-v3-0-c61026740d7b@hartkopp.net> To: Marc Kleine-Budde , "David S. Miller" , Urs Thuermann , Vincent Mailhol Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Hartkopp X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=ed25519-sha256; t=1771519907; l=1840; i=socketcan@hartkopp.net; s=20260128; h=from:subject:message-id; bh=ce7R8+1V1nd+aDx9P0nYxydlLO4gPk56OeKnN14t8O4=; b=NI/Zlcw/wCHgSJq9WwYK+uKaDdwN14qJIYw5kqLk0kNHqzTrxm8XvQKSCjFB8zJ9covPS5WHC /sU+xTvn5moD1gQqVmrLSWS5mb+oet2z7PmhEIxmXoJ/bW+RIrhnnpP X-Developer-Key: i=socketcan@hartkopp.net; a=ed25519; pk=/gU/7/wBqak3kTsTeFbCCqUi9dnh+1i6ITEkfPj/BvU= X-Endpoint-Received: by B4 Relay for socketcan@hartkopp.net/20260128 with auth_id=620 X-Original-From: Oliver Hartkopp Reply-To: socketcan@hartkopp.net From: Oliver Hartkopp Commit 80b5f90158d1 ("can: statistics: use atomic access in hot path") fixed a KCSAN issue in can_receive() but missed to convert the 'matches' variable used in can_rcv_filter(). Fixes: 80b5f90158d1 ("can: statistics: use atomic access in hot path") Signed-off-by: Oliver Hartkopp --- net/can/af_can.c | 4 ++-- net/can/af_can.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/can/af_can.c b/net/can/af_can.c index 22c65a014861..31a5eab3fab3 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -467,11 +467,11 @@ int can_rx_register(struct net *net, struct net_devic= e *dev, canid_t can_id, dev_rcv_lists =3D can_dev_rcv_lists_find(net, dev); rcv_list =3D can_rcv_list_find(&can_id, &mask, dev_rcv_lists); =20 rcv->can_id =3D can_id; rcv->mask =3D mask; - rcv->matches =3D 0; + atomic_long_set(&rcv->matches, 0); rcv->func =3D func; rcv->data =3D data; rcv->ident =3D ident; rcv->sk =3D sk; =20 @@ -571,11 +571,11 @@ void can_rx_unregister(struct net *net, struct net_de= vice *dev, canid_t can_id, EXPORT_SYMBOL(can_rx_unregister); =20 static inline void deliver(struct sk_buff *skb, struct receiver *rcv) { rcv->func(skb, rcv->data); - rcv->matches++; + atomic_long_inc(&rcv->matches); } =20 static int can_rcv_filter(struct can_dev_rcv_lists *dev_rcv_lists, struct = sk_buff *skb) { struct receiver *rcv; diff --git a/net/can/af_can.h b/net/can/af_can.h index 22f3352c77fe..87887014f562 100644 --- a/net/can/af_can.h +++ b/net/can/af_can.h @@ -50,11 +50,11 @@ =20 struct receiver { struct hlist_node list; canid_t can_id; canid_t mask; - unsigned long matches; + atomic_long_t matches; void (*func)(struct sk_buff *skb, void *data); void *data; char *ident; struct sock *sk; struct rcu_head rcu; --=20 2.51.0