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 667074CDDF3; Thu, 17 Sep 2026 15:38:27 +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=1789659514; cv=none; b=cNj1jei5POcHtCUid6Ae9aMHSntmpALLqyDzzAdAum+CXzlHzk9/Bk1CO7yJAdIWwZhkz0W3k4z30MFO4nYDeLPQBs/+Hh8K8vuxMBJHsJ46Y0+49u/HqMF4V9ApgKHUAVEYl1ACOv122T/jNBL9rCkY9CdECPXQkCDgEKIuLi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789659514; c=relaxed/simple; bh=6vNZMspsa7sBFcd6IteYwCftYy9ZWmpRJnc5e8mmsQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VwEETIj5g2I3FxtBC+ZX66p0nbSsLSfnv1PneF+xnA4ijM6wvbQi+kVDNbfdUb8C37h84LfiXu0OGu8pVwZAqpncmh6Ds31d3CiTX57mwlrCYNO7S5G6vApd0PiOe+/BQIHtQ4yg8p0bbENpGIyH4W5ywULd18VLHGjrodb7cEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H8RD4ewJ; 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="H8RD4ewJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 457261F000FF; Thu, 17 Sep 2026 15:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789659504; bh=lQklQTT9em5ThS201I3rWlkbV6cATVlx5nyi8B9PuN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H8RD4ewJ1hLhYAgqfUd5K6r9iEsLxP8V981Cm9sc0+nze3yZnJWobav0p/Qx6Mz0c 7XACL/LaOr5LJBk/xDp5MO439DIe5Ym+gqSfJnKIUWGAuNj6ZxmDECcxIHixyCy95r JpOfO4TU7ostFDskTByb3P2osOt/DVOpzbKaXYS4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nikolay Aleksandrov , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 7.2 278/733] net: bridge: mcast: properly convert mglist to rcu Date: Thu, 17 Sep 2026 16:09:46 +0100 Message-ID: <20260917151358.292480804@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151350.597953846@linuxfoundation.org> References: <20260917151350.597953846@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nikolay Aleksandrov [ Upstream commit 4b772869a1e5f9da5cef5b9c722ec0aa424ee0a0 ] Sashiko reported a bug [1] that br_multicast_del_port_group unlists the port group not using proper rcu helper that preserves the next pointer and after that immediately frees the port group without waiting for rcu grace period. The only rcu walker of mglist is br_multicast_list_adjacent() and it turns out that function has always been buggy because mglist was never properly converted to RCU. Fix it by converting it to rcu and moving its initialization after eth_addr's. Initializing p->next can use RCU_INIT_POINTER because we have a barrier from the hlist_add_head_rcu call later, besides we're initializing an unpublished structure anyway. [1] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260826014200.362304-1-littleddfu%40gmail.com Fixes: 07f8ac4a1e26 ("bridge: add export of multicast database adjacent to net_dev") Signed-off-by: Nikolay Aleksandrov Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20260903093851.1494297-1-razor@blackwall.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/bridge/br_multicast.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index ec0339e204bda..2191d35d9fa07 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -1435,16 +1435,17 @@ struct net_bridge_port_group *br_multicast_new_port_group( goto free_out; } - rcu_assign_pointer(p->next, next); timer_setup(&p->timer, br_multicast_port_group_expired, 0); timer_setup(&p->rexmit_timer, br_multicast_port_group_rexmit, 0); - hlist_add_head(&p->mglist, &port->mglist); if (src) memcpy(p->eth_addr, src, ETH_ALEN); else eth_broadcast_addr(p->eth_addr); + RCU_INIT_POINTER(p->next, next); + hlist_add_head_rcu(&p->mglist, &port->mglist); + return p; free_out: @@ -1459,11 +1460,11 @@ void br_multicast_del_port_group(struct net_bridge_port_group *p) struct net_bridge_port *port = p->key.port; __u16 vid = p->key.addr.vid; - hlist_del_init(&p->mglist); + hlist_del_init_rcu(&p->mglist); if (!br_multicast_is_star_g(&p->key.addr)) rhashtable_remove_fast(&port->br->sg_port_tbl, &p->rhnode, br_sg_port_rht_params); - kfree(p); + kfree_rcu(p, rcu); br_multicast_port_ngroups_dec(port, vid); } -- 2.53.0