From mboxrd@z Thu Jan 1 00:00:00 1970 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 84D6131E832; Mon, 13 Apr 2026 16:54:47 +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=1776099287; cv=none; b=mNM3k/BnaAqRTr3/+6ezpyWrywFT+iE5QeFd0JGpDF4uzOyOTpIBijR2Yf+4bYiMBGWfMf7LrbdTo/Q+DJqFusgWrsQN9tvlWVF+erABeav5ttkmHbdfXi3peDUhFGXbtHh6j8o/Q8H6zXIMTCOjH8gNXkSBQS8rPUYmZA0AvaM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776099287; c=relaxed/simple; bh=DoVeHWLKZX9/vwHG3G4NHbdIv1s8iBWUE8t8WLNsvj8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ryi4b+r9NkdkHI8GpT2QwIwIPboz3Ats8mJKH6V++dQdkF/qQJK5PPQKNVjvrqQFLci1pM0oYQr5MjBT4xGbkLFMi3pCvZ1X+Pu3QfUNJJNXrd49m3ZsOuBQwkczubEfG1RRQ2Tm+VtH7OOfPG8S/O+d2kurh+AR10BhWzIDAxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R+P878oK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="R+P878oK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD719C2BCB3; Mon, 13 Apr 2026 16:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776099287; bh=DoVeHWLKZX9/vwHG3G4NHbdIv1s8iBWUE8t8WLNsvj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R+P878oKVpELy/R/5p7GlYatLT2m5vQlWfy2d69ke69dTWmSRjbhxPP7Cqz0CtiY1 afYIbDo467YM6fv/LhtKs1GbRu1NXEQv3FSWBysD5MZxkbtmiGG7OIdznDdpDPdamW 2rQIkTn+3IX051OwR+B9vPcUa7+8RNLUXhuF55cI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Oliver Hartkopp , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.10 251/491] can: statistics: add missing atomic access in hot path Date: Mon, 13 Apr 2026 17:58:16 +0200 Message-ID: <20260413155828.451909744@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Oliver Hartkopp [ Upstream commit 46eee1661aa9b49966e6c43d07126fe408edda57 ] 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 Link: https://patch.msgid.link/20260318173413.28235-1-socketcan@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- net/can/af_can.c | 4 ++-- net/can/af_can.h | 2 +- net/can/proc.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/net/can/af_can.c b/net/can/af_can.c index 3e77a52709aaa..97c48f350ce0b 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -469,7 +469,7 @@ int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id, rcv->can_id = can_id; rcv->mask = mask; - rcv->matches = 0; + atomic_long_set(&rcv->matches, 0); rcv->func = func; rcv->data = data; rcv->ident = ident; @@ -573,7 +573,7 @@ EXPORT_SYMBOL(can_rx_unregister); static inline void deliver(struct sk_buff *skb, struct receiver *rcv) { rcv->func(skb, rcv->data); - rcv->matches++; + atomic_long_inc(&rcv->matches); } static int can_rcv_filter(struct can_dev_rcv_lists *dev_rcv_lists, struct sk_buff *skb) diff --git a/net/can/af_can.h b/net/can/af_can.h index 22f3352c77fec..87887014f5628 100644 --- a/net/can/af_can.h +++ b/net/can/af_can.h @@ -52,7 +52,7 @@ 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; diff --git a/net/can/proc.c b/net/can/proc.c index 2be4a239f31e4..550d46d1c60a4 100644 --- a/net/can/proc.c +++ b/net/can/proc.c @@ -200,7 +200,8 @@ static void can_print_rcvlist(struct seq_file *m, struct hlist_head *rx_list, " %-5s %03x %08x %pK %pK %8ld %s\n"; seq_printf(m, fmt, DNAME(dev), r->can_id, r->mask, - r->func, r->data, r->matches, r->ident); + r->func, r->data, atomic_long_read(&r->matches), + r->ident); } } -- 2.51.0