From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 91365481DD; Sat, 30 May 2026 17:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160881; cv=none; b=DhaglIsbT0/T9hdT2konRSTG6xj+aKXQfvcDKeXdxfTzS6pMoNH8yQgiGDSMZv2yN/KI4qJ6J5Rxnm/WAq26BRAhjAWr12apCgtdn4QpNILJU07tZ3WqqJPB07mDX1s+hn1yxEuXKx0lVgs4qR3DwWlT3ta8coW9Sp7kp8EoflE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160881; c=relaxed/simple; bh=9mOsLb2eCp8csUliaBJuSGs4EtBDq/xpTNiUCjSgYK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oicH2Gq+ho8rWgVrKOobHvboV1hgSTbeiPOys/lMjrpRVicBLdPg7eLK+MSPwB6HWUL5DUPrYbrCWWhcVUn+sdXqiUFnQqJfvhi0g3MEgdQfHsBsVfjyNN25LfdRi7DdbxrEuzRAcJDyIgujQpOUiSMUBGJLTEkIZujOksF/hXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ELdXk2Ln; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ELdXk2Ln" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D72DE1F00893; Sat, 30 May 2026 17:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780160880; bh=pFkzf+Uh4vF7slg3vJ7MfY33a2LUG8qQcaLdl44fzR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ELdXk2LnNHJ2GMkHUfHpoh0eaxdDf5RG3LbdBzCjl+x1uIbjcB2XqhO/z/+M1FLG4 n+2OKmHnFMw5/CRkCOWv/Vge0p9zDT+eADVOCDbIVa521lnmt28VVWmUaK9q5R876X RB8b+Nj+XC96Tk52hHdbxqAIXPn1UmvrJj1tuC0w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 461/969] macvlan: annotate data-races around port->bc_queue_len_used Date: Sat, 30 May 2026 17:59:45 +0200 Message-ID: <20260530160313.013045477@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@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 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 1ef5789d9906df3771c99b7f413caaf2bf473ca5 ] port->bc_queue_len_used is read and written locklessly, add READ_ONCE()/WRITE_ONCE() annotations. While WRITE_ONCE() in macvlan_fill_info() is not yet needed, it is a prereq for future RTNL avoidance. Fixes: d4bff72c8401 ("macvlan: Support for high multicast packet rate") Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260401103809.3038139-2-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/macvlan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 24e36d78a23ae..14018be5e7e70 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -344,6 +344,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port, const struct macvlan_dev *src, struct sk_buff *skb) { + u32 bc_queue_len_used = READ_ONCE(port->bc_queue_len_used); struct sk_buff *nskb; int err = -ENOMEM; @@ -354,7 +355,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port, MACVLAN_SKB_CB(nskb)->src = src; spin_lock(&port->bc_queue.lock); - if (skb_queue_len(&port->bc_queue) < port->bc_queue_len_used) { + if (skb_queue_len(&port->bc_queue) < bc_queue_len_used) { if (src) dev_hold(src->dev); __skb_queue_tail(&port->bc_queue, nskb); @@ -1695,7 +1696,8 @@ static int macvlan_fill_info(struct sk_buff *skb, } if (nla_put_u32(skb, IFLA_MACVLAN_BC_QUEUE_LEN, vlan->bc_queue_len_req)) goto nla_put_failure; - if (nla_put_u32(skb, IFLA_MACVLAN_BC_QUEUE_LEN_USED, port->bc_queue_len_used)) + if (nla_put_u32(skb, IFLA_MACVLAN_BC_QUEUE_LEN_USED, + READ_ONCE(port->bc_queue_len_used))) goto nla_put_failure; return 0; @@ -1751,7 +1753,7 @@ static void update_port_bc_queue_len(struct macvlan_port *port) if (vlan->bc_queue_len_req > max_bc_queue_len_req) max_bc_queue_len_req = vlan->bc_queue_len_req; } - port->bc_queue_len_used = max_bc_queue_len_req; + WRITE_ONCE(port->bc_queue_len_used, max_bc_queue_len_req); } static int macvlan_device_event(struct notifier_block *unused, -- 2.53.0