Re: [BUG] net: bridge: mdb: duplicate sources make the RTM_NEWMDB error path delete a source twice
From: Ido Schimmel
Date: Fri Nov 20 2026 - 10:15:15 EST
On Mon, Nov 16, 2026 at 09:10:10PM -0800, Kyuwon Cho wrote:
> Hi Nikolay, Ido,
>
> While testing v7.4-rc3 with an LLM-guided test generator that we are
> developing as a research prototype, we found that an RTM_NEWMDB request
> with a repeated source address and a later invalid source hits the
> WARN_ON_ONCE() in br_mdb_del_group_src(). An unprivileged user can do
> this from its own user and network namespace:
>
> WARNING: net/bridge/br_mdb.c:901 at br_mdb_add_group_srcs+0x375/0x4a0, CPU#1: test/106
> CPU: 1 UID: 65534 PID: 106 Comm: test Not tainted 7.4.0-rc3 #1 PREEMPT(lazy)
> RIP: 0010:br_mdb_add_group_srcs+0x375/0x4a0
> Call Trace:
> <TASK>
> br_mdb_add+0x7e2/0x1390
> rtnl_mdb_add+0x218/0x490
> rtnetlink_rcv_msg+0x2f7/0xb80
> netlink_rcv_skb+0x11f/0x350
> netlink_unicast+0x518/0x870
>
> br_mdb_config_src_list_init() counts and parses the MDBE_ATTR_SRC_LIST
> entries but does not reject duplicates. In br_mdb_add_group_srcs() the
> second copy of a source finds the entry that the first copy created, so
> both refer to the same struct net_bridge_group_src. When a later source
> fails (here 0.0.0.0, which is_valid_mdb_source() accepts but
> br_multicast_new_group_src() rejects), the error path deletes every
> source added so far, duplicates included:
>
> err_del_group_srcs:
> for (i--; i >= 0; i--)
> br_mdb_del_group_src(pg, &cfg->src_entries[i]);
>
> The first deletion frees the entry, and the second does not find it:
>
> ent = br_multicast_find_group_src(pg, &src->addr);
> if (WARN_ON_ONCE(!ent))
> return;
>
> We have not seen memory corruption from this; the effect is the warning,
> which panics a machine with panic_on_warn.
>
> Rejecting duplicate source entries in br_mdb_config_src_list_init(), or
> making the error path delete only the sources this request created,
> should avoid it. We have not tested either change.
>
> The reproducer runs as an unprivileged user (uid 65534) that creates a
> user and network namespace, makes a bridge with a port, and sends
> RTM_NEWMDB with NLM_F_REPLACE and the sources 10.0.0.1, 10.0.0.1 and
> 0.0.0.0. On an x86_64 QEMU guest with 2 vCPUs and KASAN (gcc 13.3,
> config attached), it warns in every run (5 of 5).
>
> Checked against v7.4-rc3 (aebb72744764); br_mdb.c is the same in
> net-next (6ff4c5942a30). We found no earlier report on syzbot or on the
> bridge list.
>
> The reproducer (repro.c) and the kernel config are attached.
Thanks. I will send a fix and a selftest.