From: Cheng Yongkang <teel4res@gmail.com>
To: Nikolay Aleksandrov <razor@blackwall.org>,
Ido Schimmel <idosch@nvidia.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
bridge@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [BUG] net: bridge: failed attach leaks slave promiscuity
Date: Thu, 22 Oct 2026 02:14:45 -0700 [thread overview]
Message-ID: <20261022091445.3650534-1-teel4res@gmail.com> (raw)
Hi all,
br_add_if() can acquire a promiscuity reference for the new slave before
a later error sends it to the err6 unwind. nbp_vlan_init() allocation
failure is one reachable point.
The successful prefix does:
list_add_rcu(&p->list, &br->port_list)
nbp_update_port_count()
br_manage_promisc()
br_port_set_promisc()
dev_set_promiscuity(dev, +1)
The err6 path then removes the port from port_list before the remaining
nbp_update_port_count() call, so the removal path cannot see or clear
the port's promiscuous state. The later dev_set_allmulti(dev, -1)
balances only the separate allmulti reference.
Observed on Linux v7.3, commit
08ab31164c55f20c7a2653de3186ae333470e2c1. Failslab forced an
allocation failure in the first nbp_vlan_init() allocation. The failed
attach returned an error and left no master, but the slave's
IFLA_PROMISCUITY grew 0 -> 1 -> 2 -> 3 across repeated failures.
A later successful attach/detach moved the counter 3 -> 4 -> 3. Another
successful cycle returned to 3, proving the first attach/detach pair was
balanced and could not remove the references leaked by failed attaches.
The error path must explicitly release the promiscuous reference before
unlinking the port, or reorder teardown so the normal promiscuous update
still includes the failing port.
The PoC, fault-injection runner, and complete program/serial logs are
available on request.
This was found with a multi-agent workflow; the state
leak was reproduced under KASAN+UBSAN (no crash is expected).
Thanks,
Cheng Yongkang
reply other threads:[~2026-10-22 9:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261022091445.3650534-1-teel4res@gmail.com \
--to=teel4res@gmail.com \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®