Article View: linux.kernel.netdev
Article #13671Re: [PATCH 6.6.y] net: free_netdev: exit earlier if dummy
From: Dust Li
Date: Tue, 10 Nov 2026 06:36
Date: Tue, 10 Nov 2026 06:36
73 lines
11183 bytes
11183 bytes
On 2026-11-08 00:14:15, Dust Li wrote:
Hi Greg, Sasha
Can you pick up this patch for 6.6 ?
This is a prerequisite that was missed when 6.6.y picked up the
dummy-net_device conversion of the mediatek driver.
6.6.158 took b209bd6d0bff ("net: mediatek: mtk_eth_sock: allocate dummy
net_device dynamically") as d5d57501f543, followed by 16f3a28cf5f8
(as 81e82340170ae) and "allocate dummy netdev sooner" (efc91ab1d97bd).
alloc_netdev_dummy() -> init_dummy_netdev_core() sets
dev->reg_state = NETREG_DUMMY, but 6.6.y free_netdev() only special
cases NETREG_UNREGISTERING and NETREG_UNINITIALIZED. So every
free_netdev(eth->dummy_dev) -- mtk_remove() at
drivers/net/ethernet/mediatek/mtk_eth_soc.c and the probe error
path -- walks into
BUG_ON(dev->reg_state != NETREG_UNREGISTERED);
Upstream f8d05679fb3f and b209bd6d0bff both landed in v6.10-rc1, so
mainline was never broken.
5.10.y / 5.15.y / 6.1.y - alloc_netdev_dummy() does not exist and no
driver creates a dynamically allocated
dummy net_device
So only 6.6.y need this.
Best regards,
Dust
>From: Breno Leitao <leitao@debian.org>
>
>For dummy devices, exit earlier at free_netdev() instead of executing
>the whole function. This is necessary, because dummy devices are
>special, and shouldn't have the second part of the function executed.
>
>Otherwise reg_state, which is NETREG_DUMMY, will be overwritten and
>there will be no way to identify that this is a dummy device. Also, this
>device do not need the final put_device(), since dummy devices are not
>registered (through register_netdevice()), where the device reference is
>increased (at netdev_register_kobject()/device_add()).
>
>Suggested-by: Jakub Kicinski <kuba@kernel.org>
>Signed-off-by: Breno Leitao <leitao@debian.org>
>Reviewed-by: Ido Schimmel <idosch@nvidia.com>
>Signed-off-by: David S. Miller <davem@davemloft.net>
>Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
>---
> net/core/dev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/net/core/dev.c b/net/core/dev.c
>index f9436563a2e84..0d88d285c713f 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -11093,7 +11093,8 @@ void free_netdev(struct net_device *dev)
> dev->xdp_bulkq = NULL;
>
> /* Compatibility with error handling in drivers */
>- if (dev->reg_state == NETREG_UNINITIALIZED) {
>+ if (dev->reg_state == NETREG_UNINITIALIZED ||
>+ dev->reg_state == NETREG_DUMMY) {
> netdev_freemem(dev);
> return;
> }
>--
>2.43.7
Technical Details
Message-ID:
<avK7XqLvdaeWlp8o@linux.alibaba.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359913-linux-kernel-netdev=dewy.ruReferences:
<20261107161415.1917665-1-dust.li@linux.alibaba.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359913-linux-kernel-netdev=dewy.ru
From: dust.li@linux.alibaba.com (Dust Li)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 6.6.y] net: free_netdev: exit earlier if dummy
Date: Tue, 10 Nov 2026 14:36:14 +0800
Organization: Usenet Network
Message-ID: <avK7XqLvdaeWlp8o@linux.alibaba.com>
References: <20261107161415.1917665-1-dust.li@linux.alibaba.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="540705"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:RtwLGRk9vxbZbHTTunqWTYVQ3eA= sha256:zbCfHEoy6RFtPWsY8lUt9Q1HCe5WNV0S5rXbk4B7nQY=
sha1:yEds/gRX8o/KOa9IQMi95xmSLm8= sha256:PYIZx3H8SP92OITmnK9vkY98gsxU/f7vvsmcCH+B9NY=
Content-Disposition: inline
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 45565113A51; Tue, 10 Nov 2026 09:36:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -10.55
X-Spam-Status: No, score=-10.55 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=linux.alibaba.com
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 srKu1Imrc2-0;
Tue, 10 Nov 2026 09:36:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-359913-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id CAFF3113A4A; Tue, 10 Nov 2026 09:36:38 +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 4FF572624E; Tue, 10 Nov 2026 06:36:22 +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=1794292582;
b=w/79mxS2F4j4fmQ7pFPvnzjAS7/IdmMxcBav9ZO0CwTWi408ugqHipuI5Ngi6tGhVKKd
adfyXqKUKeyorrgAfsbCo/Bwf+EGiV422HEle6d0jjQ4M1HhBy1CdXGVZKnyILjcqF9ft
iZ472a/xNQhD+HhO9HC+zuiMW/z0VZ5t8wXm9td6bjewr94jflIwcrLy4/oScN3vuw4+x
4B7cIjRI5YRSN2YBhruBk/lfrMcnC8q4soV4J9nXYC/tlwDbqEKo0T306tLtskCt1peCh
1lC7KUeYbj4z7YjycJV9BxW77okp39LSD8dulvKFZLPSPhI73N/VdA/i6ONnkflz8mA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794292582;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
X-Alimail-AntiSpam:Received:Date:From:To:Cc:Subject:Message-ID:
Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To;
bh=IwZOJTDMawQ4UNnA78gZHvTpYkIrlTeCJJMbG+5ZzWY=;
b=LmZ4tZgqpSShy+sKJQCumL3svX6r/Xdl5B53bkRLI+0y+yyfsAuRCvXV/dPsxUjl+62k
uaXNbNnv3euD3k1P/GRJpGAbObLASKDIICgC97nfNtkaLA9SUSqf7WqyRUJC/cy5OkMmM
LiDshUtdXXghk+D4zWFeMEJiTszOnTBJs3IbspXxBcdxu4f0qKDUhF1k0+Uc3eBGj+nrI
ZtBVo0qSQCmgI4s3iBHvUkP0erEjWqLJgjT8gSw85vohGVVLK2xFc8GhCfxstVvYVBXke
VXBTBvz8JbbfKsyQGMw1eTk1pVuM3D+3HVlliePVc2jc19cHXUXQm6yyWjHi6dmRnTQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=ii8G05K+;
dmarc=pass header.from=linux.alibaba.com;
spf=pass smtp.mailfrom=linux.alibaba.com;
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 16117606A31C;
Tue, 10 Nov 2026 06:36:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=ii8G05K+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.98
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794292581;
b=zyWoD66mItugmCjn52rtoRqCpEb7GgLO+jJeewX2RP/SHsBnQUcTAiPmXXfIvaf68AUF
KD7mSbP7hepdBOftp6dZpgMsdBm318y2BDH9rpg3GRpd50Rv+zzakpSTAu8z/ewIQ6Rfb
xtBtK7qbXQL7wceUJtBICIfvm/tGcMK8L4JcHToq9BIYwiXpbnpCoTppTwi4a0Xg4hYX6
Fh4M2x4l7ywj90jsS6SP/tuWKTUNck6O8BnzHy9txyInLqFZInB77btSw4p66oLN4lVWd
xSMKviLBddpa2ORb9gdKsVaegNjROBFOVUyuGaYi1sgKcI45kPLMRac9FWVlBowxBWg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794292581;
h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:Date:From:To:
Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To;
bh=IwZOJTDMawQ4UNnA78gZHvTpYkIrlTeCJJMbG+5ZzWY=;
b=U/5hUhYCYlSxFHIHVdlunKUEzvT7FDf/kkz4LCC8rOZ4VlQiTbe/TfHI1eJ/KE1ri5HV
mbssJHiTT8pV63k5ct+Q4haU7bF0TVvNcjWFUl/leLM8e8/qVBJYSwOputri03+l5mEJ2
ZfVCs2iHKbpANwTjgbhnS/gZENjK6T2aqCAv1VA5VrW/PIRdOLn1yFSio6RIuGE1Bp7s6
JL2vDlCsYzv/R4XxQdAn1xArKHs5ozc187cc+w/vmqP7lcl4gIgMR1dGemRZAddczu6DS
ExAEC1hWPGsOaoSjzgLi6z4O1u4szn7a31f/x3NwC/N+nnKYi1/+Wb4/nwdyjOddSfQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=linux.alibaba.com;
spf=pass smtp.mailfrom=linux.alibaba.com;
dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=ii8G05K+;
arc=none smtp.remote-ip=115.124.30.98
X-Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33B76606A326;
Tue, 10 Nov 2026 06:36:17 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 33B76606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=linux.alibaba.com; s=default;
t=1794292575; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
bh=IwZOJTDMawQ4UNnA78gZHvTpYkIrlTeCJJMbG+5ZzWY=;
b=ii8G05K+IsAD3FmxhhLMbpYIsLJkyiliSZhUQnCskY+NahyXG8GPuLP4qClgu+vS4GLTgfKWOyTU83NVPVTLnXKpHjVpziN+8zALZaSGoWGQObxhyBqNFIX66jbaMmp9b+xT/7VVr5kaKiPsY3MhpPP/75Wc4iD5I+wS3qyEu5o=
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0XEUO5Jc_1794292574;
X-Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0XEUO5Jc_1794292574 cluster:ay36)
by smtp.aliyun-inc.com;
Tue, 10 Nov 2026 14:36:14 +0800
X-Cc: Breno Leitao <leitao@debian.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sasha Levin <sashal@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Reply-To: dust.li@linux.alibaba.com
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
X-In-Reply-To: <20261107161415.1917665-1-dust.li@linux.alibaba.com>