Article View: linux.kernel.netdev
Article #22511Re: [PATCH net] vlan: drop the promisc/allmulti references on the real device on delete
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 13:14
Date: Wed, 25 Nov 2026 13:14
111 lines
11795 bytes
11795 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch drops the real device's promisc/allmulti reference in
vlan_dev_uninit(), but it leaves the VLAN's own…
--
vlan: drop the promisc/allmulti references on the real device on delete
This patch makes vlan_dev_uninit() drop the IFF_PROMISC and IFF_ALLMULTI
references that a VLAN device holds on its real device. Since commit
27b918007d96, vlan_dev_change_rx_flags() propagates these flags whether
or not the device is up, and nothing released them on delete.
> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> index bca0a3693636c..5286c79188714 100644
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -647,6 +647,13 @@ void vlan_dev_free_egress_priority(const struct net_device *dev)
>
> static void vlan_dev_uninit(struct net_device *dev)
> {
> + struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
> +
> + if (dev->flags & IFF_ALLMULTI)
> + dev_set_allmulti(real_dev, -1);
> + if (dev->flags & IFF_PROMISC)
> + dev_set_promiscuity(real_dev, -1);
> +
[Severity: High]
Can stacked VLANs deleted in one batch drop the real device's reference
twice?
The reference on real_dev is dropped here, but the VLAN keeps its own
IFF_PROMISC bit and promiscuity count. Nothing records that the reference
was already returned. vlan_dev_change_rx_flags() also still forwards any
later change:
net/8021q/vlan_dev.c:vlan_dev_change_rx_flags() {
...
if (change & IFF_PROMISC)
dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1);
}
Take veth0 <- v1 <- v2, run "ip link set v2 promisc on", put v1 and v2
in the same group, and then run "ip link del group N".
rtnl_group_dellink() walks the device list forward and calls
unregister_vlan_dev() on v1 and then on v2. So list_kill is [v1, v2].
unregister_vlan_dev() has already removed v2 from v1's vlan group, so
v1's NETDEV_UNREGISTER does not unregister v2 first.
unregister_netdevice_many_notify() then calls ndo_uninit in list order:
vlan_dev_uninit(v1)
dev_set_promiscuity(veth0, -1) veth0: 1 -> 0
(v1 still has IFF_PROMISC, promiscuity == 1)
vlan_dev_uninit(v2)
dev_set_promiscuity(v1, -1) v1: 1 -> 0, clears IFF_PROMISC
dev_change_rx_flags(v1)
vlan_dev_change_rx_flags(v1)
dev_set_promiscuity(veth0, -1)
__dev_set_promiscuity() only guards against wraparound when inc > 0:
net/core/dev.c:__dev_set_promiscuity() {
...
promiscuity = dev->promiscuity + inc;
if (promiscuity == 0) {
...
if (unlikely(inc > 0)) {
...
} else {
flags = old_flags | IFF_PROMISC;
}
So veth0->promiscuity would wrap to UINT_MAX with IFF_PROMISC set. veth0
would then stay promiscuous for good, and later "promisc on" requests
would fail with -EOVERFLOW.
If veth0 had another promisc user, the same sequence would turn
promiscuous mode off underneath it. That user's own -1 would then wrap
the counter. netif_set_allmulti() has the same missing underflow check,
so the allmulti path looks affected in the same way.
With the nested order ("ip link del v1", where v2 is unregistered from
v1's NETDEV_UNREGISTER), the counts stay balanced. That may be why the
single-device reproducer in the commit message passes.
Should the VLAN mark that the reference was handed back, or stop
propagating in vlan_dev_change_rx_flags() after uninit, instead of
relying only on dev->flags here?
> vlan_dev_free_egress_priority(dev);
> }
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179552079831.1290967.13072162433438626338%40gmail.com
Technical Details
Message-ID:
<179561249161.3135.16028121153100336999@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371336-linux-kernel-netdev=dewy.ruReferences:
<179552079831.1290967.13072162433438626338@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371336-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] vlan: drop the promisc/allmulti references on the real device on delete Date: Wed, 25 Nov 2026 13:14:51 +0000 Organization: Usenet Network Message-ID: <179561249161.3135.16028121153100336999@kernel.org> References: <179552079831.1290967.13072162433438626338@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="213479"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:B/p08+1QWpkFKFxyUHz/rudgjgE= sha256:+WVsLguG4TVJEhRFhLojARbXlYNniGSTnMsUINKrsO0= sha1:QhvrBbHbzm+ZV5aci44Sbpeh+xc= sha256:6ZoiHPREQQjo5cX0Xr9XRgxRsxfyHqVqQ5Eg+9Efiyk= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id AF588125E69; Wed, 25 Nov 2026 16:15:07 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pqQwhRShH98m; Wed, 25 Nov 2026 16:15:04 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-371336-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id D20AA125E63; Wed, 25 Nov 2026 16:14:55 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 59E813279F; Wed, 25 Nov 2026 13:14:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795612494; b=J5SQq7ZUqk8tnZ1eG9cAwTMfz8xWPh4CNhTQnwhZ76ckTAvP0OwvS+YbxsiSJ2NQcnKY XYKJ2PGOZD1N1KcsdQWZvrnhHt3bGbZxDs9jHbW7H558sZEPZ4ma5V7ZpnvQMKbl8QRbK /joQKSlbUfcrVIZ/UiGMMnK96zigYzK/U1fNf+fhKqgwqvsA2yVPvCGsizSfg8OHzOgQG nFgJSsqrPahKOxKLntCq6ZkKxHkrJTADwvT5WU7B2Jhyw2kxGMk1+IvZ3aEkOcqx2yPTz ODi1uOroIFj3I8OJ2gugrzLxUL6Iq2eMyiYagz0CFH+RcFheoCxKnaWGYtGVncaWzwg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795612494; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=/n3t44YEMmmCq63KUFEjGWIQzYqLU5gYaUwKU4iJWzo=; b=ImQcxUOJbA6OV7aL0u/Il4MKS4zRQGYe1xg0QY3s2kbx/LM5qJUBBxG//BQvlcP0+qvC dTfHTq/bzfjWx+C2EGeeFD+He50O4p1HmBx7BWAt3BsX4d0FSMQ1qWLqfx1tsGAHPiYPe RJdXnuZJGV0A+ltD7FWybuAvZf7AXLrQQr0M96hSGCZsxgOhgbkR0BmBEIvX3rual8mp0 ag7P3+I61AgeKjH89K7W9oC4LxcKTVNdxPz+gG5k8rbVwZInUyyhXFvePuiMwKB+ANUfB rBbM5pchL8NNlZsGUUigZYT68rOPhgSweYCn6K8wvueHScerdJWWffMrYKqBsE1laLA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZIqjGYyn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B610606A32D; Wed, 25 Nov 2026 13:14:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZIqjGYyn X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795612493; b=AGWFZTm7peEg9/Uc8giKTKlESqzVh6KseKSLdyBJvnC16E0pMbcswc8KlQ/Ns+qv2oVy Ye6K2w/tqOg2F7FTTXCrlqv2jsPEmhrYWEr5vpHRoI3cF5DrAyxZjkpiTjYTSUpmakDNf mRgIMGxVbnEg4n8KQfQc1O67CnCllWT+7ytbcQvPMG0N7x6ZSymrgKU6TaCUQMA19iQrq Q2LEKOLl0zoJ6E/SxY+DQ+8AcdjPclI2yRqzTJHu/J5etH9tNL4lZF1Bf8zxGypthF7EZ c2Hnm2oiics6cXVqkb7SoSiXRDtGRnSaBPRP6kEohZUx858lTyY9F6A3ViMyMVsgf2Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795612493; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=/n3t44YEMmmCq63KUFEjGWIQzYqLU5gYaUwKU4iJWzo=; b=WPau7FBdtwjMU4TSEFKgEuSK7AmMiRqK7ZGeBVgw1gwB0EO5dZrM7eF0E2BGfFFmzEv9 uD1SY8P/Tx+TK6xAbU+5WPLQ50mC31zdTVXRSW0ARmfqqmXAp3/4u7Cc6IedxuTzrS4Zk uKJKGnNbyIww3hgLftVPCISIu8jzI9ZradRbKx7KGHE2kdZXkO8KkPgSW5VKF6ZAdTpUX fPCf5bqODsYFvhIL97x/qR0JiMvzz1IC32+C55a5Qw/H09YD8AxhTOgf4RHcbk0sXuBL6 wRR2+ZfD5KCLTWRMJDa5T4tEr8dOdVLqDbW7RcAK5NLjaXyjm3OCSKVSY4o7GEatPFQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZIqjGYyn; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DDE3606A323 for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 13:14:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BE351F000D3; Wed, 25 Nov 2026 13:14:52 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795612492; bh=/n3t44YEMmmCq63KUFEjGWIQzYqLU5gYaUwKU4iJWzo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ZIqjGYynpekfFEJei9ZMc75fykkeBScwgcrIMIsCrSv5EsyLOfIMOZw/XEtNIPfbI bcPPVYufaobYkTYoIyO3STBb9ovHr8n+n2/MTHNCyxaMLeW30vQvFNMPWjQ0JlXrGi /iEMcI6IAIFEy3uVRL+j0Ctsgcr0O9y4H61NT6Ixdrw+iN25n7gea5dP9Ijo0Ih6sQ Q98/oJW0qfE40P+KyMJQDSZtrKY3qMy/4l3dWOOFEbE/KSDhM7HTpBYpJU5YHYKFlI 1xei2q7Q7VM1k77M19Lw/9xr6HSfQI+y6igMbCRES0DvaxgwA5qthhn1T8m2BR5v6N 4+yWccFHVorjw== X-Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, sdf@fomichev.me, willemb@google.com, horms@kernel.org, netdev@vger.kernel.org X-In-Reply-To: <179552079831.1290967.13072162433438626338@gmail.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list