Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 4661c91

Browse files
idoschgregkh
authored andcommitted
bridge: mcast: Fail MDB get request on empty entry
[ Upstream commit 555f45d ] When user space deletes a port from an MDB entry, the port is removed synchronously. If this was the last port in the entry and the entry is not joined by the host itself, then the entry is scheduled for deletion via a timer. The above means that it is possible for the MDB get netlink request to retrieve an empty entry which is scheduled for deletion. This is problematic as after deleting the last port in an entry, user space cannot rely on a non-zero return code from the MDB get request as an indication that the port was successfully removed. Fix by returning an error when the entry's port list is empty and the entry is not joined by the host. Fixes: 68b380a ("bridge: mcast: Add MDB get support") Reported-by: Jamie Bainbridge <jamie.bainbridge@gmail.com> Closes: https://lore.kernel.org/netdev/c92569919307749f879b9482b0f3e125b7d9d2e3.1726480066.git.jamie.bainbridge@gmail.com/ Tested-by: Jamie Bainbridge <jamie.bainbridge@gmail.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Acked-by: Nikolay Aleksandrov <razor@blackwall.org> Link: https://patch.msgid.link/20240929123640.558525-1-idosch@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e1eeec3 commit 4661c91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/bridge/br_mdb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ int br_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid, u32 seq,
16741674
spin_lock_bh(&br->multicast_lock);
16751675

16761676
mp = br_mdb_ip_get(br, &group);
1677-
if (!mp) {
1677+
if (!mp || (!mp->ports && !mp->host_joined)) {
16781678
NL_SET_ERR_MSG_MOD(extack, "MDB entry not found");
16791679
err = -ENOENT;
16801680
goto unlock;

0 commit comments

Comments
 (0)