Article View: linux.kernel.netdev
Article #27553Re: [PATCH net-next v5 1/6] net: guard leased queue ops against physical netdev unregister
From: netdev-bot+sashiko
Date: Sun, 06 Dec 2026 00:07
Date: Sun, 06 Dec 2026 00:07
129 lines
13223 bytes
13223 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit fixes concrete teardown races in recently merged
queue-lease code but carries no Fixes: tag.
- [Low] The patch reports one condition, "physical lessor device has
entered unregistration", with different user-visible errors depending…
--
net: guard leased queue ops against physical netdev unregister
This adds netdev_lock_if_alive(), which takes the instance lock and fails
if the device has entered unregistration. It is used when descending from
a leasing virtual device to the physical lessor in netif_mp_open_rxq(),
netdev_queue_get_dma_dev() and netdev_nl_bind_tx_doit().
__netif_mp_close_rxq() now clears mp_params without reconfiguring the
queue once the device is no longer alive.
> These races were identified by code inspection while adding leased-queue
> unregister support for devmem; they have not been observed in production
> or tested on real hardware. Verified with netdevsim and netkit selftests
> in nl_netdev.py and nk_qlease.py.
>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
[Severity: Low]
Should this carry Fixes: tags? It repairs teardown races in recently
merged queue-lease code, and without the tags stable and backport tooling
won't pick it up for kernels that already ship queue leasing.
Going by blame on the lines being changed, the candidates look like:
Fixes: 5602ad61ebee ("net: Proxy netif_mp_{open,close}_rxq for leased queues")
Fixes: 222b5566a02d ("net: Proxy netdev_queue_get_dma_dev for leased queues")
Fixes: 1abe839b34ae ("net: devmem: support TX over NETMEM_TX_NO_DMA devices")
The unguarded netdev_lock() calls in netif_mp_open_rxq() and
netdev_queue_get_dma_dev() were also reworked by 581d28606cdd ("net:
remove the netif_get_rx_queue_lease_locked() helpers").
[ ... ]
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index d2ccb1090496d..87dac9c5e84c3 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -1253,8 +1253,18 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)
> goto err_unlock_netdev;
> }
>
> - if (bind_dev != netdev)
> - netdev_lock(bind_dev);
> + if (bind_dev != netdev) {
> + if (!netdev_lock_if_alive(bind_dev)) {
> + err = -ENODEV;
> + NL_SET_ERR_MSG(info->extack,
> + "Device is being unregistered");
> + goto err_unlock_netdev;
> + }
> + if (!netif_device_present(bind_dev)) {
> + err = -ENODEV;
> + goto err_unlock_bind_dev;
> + }
> + }
>
> dma_dev = netdev_queue_get_dma_dev(bind_dev, 0, NETDEV_QUEUE_TYPE_TX);
>
> diff --git a/net/core/netdev_queues.c b/net/core/netdev_queues.c
> index 27cb6397bdd4e..c796957c07f4b 100644
> --- a/net/core/netdev_queues.c
> +++ b/net/core/netdev_queues.c
> @@ -50,7 +50,8 @@ struct device *netdev_queue_get_dma_dev(struct net_device *dev,
>
> hw_rxq = __netif_get_rx_queue(dev, idx)->lease;
>
> - netdev_lock(hw_rxq->dev);
> + if (!netdev_lock_if_alive(hw_rxq->dev))
> + return NULL;
[Severity: Low]
When the lessor is dying, netdev_queue_get_dma_dev() now returns NULL.
Callers already read NULL as "no DMA capable device". Does that hide the
real error from io_uring zcrx?
io_uring/zcrx.c:zcrx_register_netdev() {
...
ifq->dev = netdev_queue_get_dma_dev(ifq->netdev, if_rxq, NETDEV_QUEUE_TYPE_RX);
if (!ifq->dev) {
ret = -EOPNOTSUPP;
goto netdev_put_unlock;
}
...
}
This path holds only the netkit instance lock, not RTNL. A zcrx
registration on a netkit leased queue can therefore land in the window
between the physical device being set to NETREG_UNREGISTERING and the
cascaded netkit unlease. In that case it fails with -EOPNOTSUPP.
It never reaches netif_mp_open_rxq(), which this patch makes report the
same condition as -ENODEV with "Device is being unregistered".
The netif_device_present(bind_dev) check added to
netdev_nl_bind_tx_doit() above also returns -ENODEV without an extack
message. The ifindex the user passed is the netkit device, which still
exists. Would an extack message help there, since the device that went
away is one the user never named?
At this commit, bind-rx also turns the new NULL into -EOPNOTSUPP "Device
doesn't support DMA" via net_devmem_bind_dmabuf(). A later patch in this
series, "net: devmem: resolve leased RX queues to physical device on
bind", appears to fix that part. It routes bind-rx through
netdev_nl_resolve_rx_phys(), which returns -ENODEV "Device is being
unregistered". Both the zcrx -EOPNOTSUPP mapping and the missing bind-tx
extack are still there at the end of the series.
> idx = get_netdev_rx_queue_index(hw_rxq);
> dma_dev = __netdev_queue_get_dma_dev(hw_rxq->dev, idx);
> netdev_unlock(hw_rxq->dev);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204231030.3815575-1-almasrymina%40google.com
Technical Details
Message-ID:
<179651565922.3148.7652510579542585203@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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-378187-linux-kernel-netdev=dewy.ruReferences:
<20261204231030.3815575-2-almasrymina@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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-378187-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 1/6] net: guard leased queue ops against physical netdev unregister Date: Sun, 06 Dec 2026 00:07:39 +0000 Organization: Usenet Network Message-ID: <179651565922.3148.7652510579542585203@kernel.org> References: <20261204231030.3815575-2-almasrymina@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3148270"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XUMe+xOBEgPn01/tfVI26SMsV2g= sha256:GOQcAftZ/ylb49gO00hDLn/QChaGbY4tRsDwwSy7Vfg= sha1:VSQRvvS0MMl6U2K5R6fGc5jEns0= sha256:cJYExLI5uwtglcIaFbFRKAqWAA4sAP8xjujonE4srJ0= 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 14D75117EFB; Sun, 6 Dec 2026 03:08:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.54 X-Spam-Status: No, score=-3.54 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, 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] 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 g6M2rmZvdYfb; Sun, 6 Dec 2026 03:08:00 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378187-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 3A12A117E93; Sun, 6 Dec 2026 03:07:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 45A6031176; Sun, 6 Dec 2026 00:07:42 +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=1796515661; b=cbHZUgHNIcNJQPLv+qpWeUsEvPDy4+l6OUlMlDbFaePm1wwHQIMD1Dlg8vuiDVhybNCi hTCoqfSx4ilWW1/kBu6Ke9Qt9ZdAyq+kicrDdRPfiMvqcDN7OIubyFC641EB7SdoPD/Re F1uYbEyxFkW24OomQ1ZVlifbaAGK8sypnwctdZZf32q0ciEMDeua/gSiLIgEI3Gb3Eh0v RHwKtQ20vNp4i5nBoJP9viB3EKnzMjoXDPgQmw6iJ4kEtf4IKFSwSRJeBKZTk2h7223QB MXPFknYqGcq3uoNNBIQTJersGgrxnP0OLcVMCQzl1JysQdhEDvQKvul6HSzdNrHPtRQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796515661; 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=slDtqJ2D7bDzTqjdczEzxkRXDZl4dFJU1G3V4NdNRAc=; b=dZWAUpL4dNfdMKo74HxXmMyOxzCUf6/vp63qm8qo5A4yLN7L0+LIyqL5bA9BBP0NXtHk bw9eL8TLAAwJgjxwCOnvD+0SjKBsbzIM9tGSg5U0Y+KqM8CidczVnOHF/29soVCkxielH D9y44rJw/he2Yv7wTvPjyGoI3/OaPQf5cewC0b1K7J6AAJv/xQkPUwBaftf/2OS+Eukjx vDmoX+yIfU1tQesutm2XWOZaPB0LUaUwnjp5s5UMMc/nUhsyCJFyRdzWClWLEwxl16MwB OkCWNo8A84AOVwu1V313/xHe5Xjo8XV1wdefdapK+y7zylRwWjmldeBZSoo7hcmKakA== 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=lvIm8Pmv; 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 C3490606A333; Sun, 6 Dec 2026 00:07:41 +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=lvIm8Pmv 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=1796515661; b=LvFhfXoCaAl6JsmfAzVYjg4ruMDLyYXegqiXf4mZzuxrR6OCVbeN0Yw+bjM3tKHVnOLI q0srpjk0Py34+G7UPW1KvNBuToL2ZzXQEiF3qLWL9tpHDtWeaA2PxN39FSoktOZzvDEHn kvnTvEtCg8KfBdgAUwgw/nbcXH5PlHwCNyNXOSsghJOE8roj/MyXwsE4yWOJJ0cTtaUz/ EviniSoIuEHCft+m3xi1E1ke4YLuJCZLos36X8XxsOKkcuw5FIiNNLGo7cgc6UV0dJkdu z/V9M/fgJdNUhpELRZKqYQDOFDDsW0Mm6XeFRBd4V6dRgNj4SH0XoIr823m92tmcjIg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796515661; 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=slDtqJ2D7bDzTqjdczEzxkRXDZl4dFJU1G3V4NdNRAc=; b=2/JKTEBwM2yvN2L5oLYSqqV6GYwkI2Knnx9Ptq2tOEyB9gp0Oczo9C7b9ni8HQwh47ox ZW5mz4m+D8MhpQ7M1/0pFhpyx/sRXUX0D1tIkLTRwJbE36i7iWLDIXyNndWCrN+A18/bQ M6AFLwMNOl6310Qjv2Bbymus3keWwEBCUkGttVNUUaU/R7SErfvjxJSRH0uDZ/QNpUCFS Ap/gMtPVxLzEVkdATbkikas6BcCEKJdtUmgYyuloypy8jLqtH7jUZS3mepnK0c3AieOqc 2CxIPPscAYn15rUTc2gJ7SuvmIbuL8ttawHqex9yTrKfzeJoLx1xgHXR87bsixzH8Gg== 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=lvIm8Pmv; 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 E2ADD606A322; Sun, 6 Dec 2026 00:07:40 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A32191F0092B; Sun, 6 Dec 2026 00:07:39 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796515660; bh=slDtqJ2D7bDzTqjdczEzxkRXDZl4dFJU1G3V4NdNRAc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=lvIm8PmveSpL/tggmX+ubwK5PTBBugmk6RNAnSNlkVRpzfkfYJPkXCJSS+YEW+sk0 pcCPtltAAnmvAH4V9OXqgkxRhfY+qnqtrnNgw84iMIQ0CSzfdIXpUyIPs/volewbSR 0DnnJ33elluD73sMBHsk+wv57nPO+qRJl2HKtGGati0bnyl4dwPylsxMwXC/uvc+Uz 4qA6LUPYA3Sbkiz/HzEycDRVhYnQ2GLz4ZqnznwxM0EjOrxYkK4XSpYU8Y7FDse355 wJBAnlEYNOwYO560SXdMCFX1+ks6XO9AQA/l0TaTd18Nezgt4/xPg0V0B5QRgp7mO0 200xeqwsrwQWw== X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org, sdf.kernel@gmail.com, bobbyeshleman@meta.com, razor@blackwall.org, daniel@iogearbox.net, dw@davidwei.uk, asml.silence@gmail.com, axboe@kernel.dk, bestswngs@gmail.com, io-uring@vger.kernel.org, hawk@kernel.org, ilias.apalodimas@linaro.org X-In-Reply-To: <20261204231030.3815575-2-almasrymina@google.com> X-sashiko-severity: Low 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