Article View: linux.kernel.netdev
Article #27429Re: [PATCH net] net: ps3: Unregister Ethernet when wireless probe fails
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 17:20
Date: Sat, 05 Dec 2026 17:20
121 lines
12579 bytes
12579 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 (1) · Medium: 1 · 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).
- [Medium] In ps3_gelic_driver_probe()
(drivers/net/ethernet/toshiba/ps3_gelic_net.c), the new wireless-…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but it is a use-
after-free on the very teardown path the patch fixes.
--
net: ps3: Unregister Ethernet when wireless probe fails
This patch adds an unregister_netdev() call on the wireless probe
failure path in ps3_gelic_driver_probe(). The goal is to unregister the
already registered Ethernet netdev before the shared error unwind calls
free_netdev().
> diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
> index d35d1f3c10a18..dc660326bc122 100644
> --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
> +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
> @@ -1801,6 +1801,7 @@ static int ps3_gelic_driver_probe(struct ps3_system_bus_device *dev)
> result = gelic_wl_driver_probe(card);
> if (result) {
> dev_dbg(&dev->core, "%s: WL init failed\n", __func__);
> + unregister_netdev(netdev);
> goto fail_setup_netdev;
[Severity: Medium]
Can card->tx_timeout_task still be pending or running when the unwind
frees the card?
gelic_net_setup_netdev() has already registered eth0 by the time
gelic_wl_driver_probe() runs, so userspace can bring eth0 up. If the TX
watchdog then fires, gelic_net_tx_timeout() queues the driver-owned
work:
atomic_inc(&card->tx_timeout_task_counter);
if (netdev->flags & IFF_UP)
schedule_work(&card->tx_timeout_task);
unregister_netdev()->dev_close() stops the core watchdog timer. Neither
it nor gelic_net_stop() cancels tx_timeout_task. The unwind then
reaches:
fail_status_indicator:
ps3_system_bus_set_drvdata(dev, NULL);
kfree(netdev_card(netdev)->unalign);
free_netdev(netdev);
If the work is still pending, gelic_net_tx_timeout_task() calls
container_of() on the freed card and reads card->netdev[0]->flags.
If the work is already running inside
gelic_net_open()->gelic_card_up(), it can turn the IRQ mask, RX DMAC
and NAPI back on while the unwind is freeing the descriptor chains.
ps3_gelic_driver_remove() waits for this work before it frees the card:
wait_event(card->waitq,
atomic_read(&card->tx_timeout_task_counter) == 0);
Should this path have a matching step, such as
cancel_work_sync(&card->tx_timeout_task) after unregister_netdev()?
To hit this window, eth0 has to be opened and the watchdog (5*HZ) has
to fire while gelic_wl_driver_probe() is still running. That may be
hard to trigger in practice.
[Severity: High]
This isn't a bug introduced by this patch, but the unwind that this
path now reaches appears to have a use-after-free of card->napi.
The card is kzalloc'd separately from the netdev, and napi is its first
member. gelic_ether_setup_netdev_ops() links it into the netdev:
netif_napi_add(netdev, napi, gelic_net_poll);
The error tail then frees the card before it frees the netdev:
kfree(netdev_card(netdev)->unalign);
free_netdev(netdev);
free_netdev()->netdev_napi_exit() walks dev->napi_list and calls
__netif_napi_del_locked() on &card->napi. That function runs
test_and_clear_bit() on napi->state, hrtimer_cancel(&napi->timer) and
list_del_rcu(&napi->dev_list), all on the card that was already freed.
ps3_gelic_driver_remove(), which is also the .shutdown callback, frees
in the same order:
unregister_netdev(netdev0);
kfree(netdev_card(netdev0)->unalign);
free_netdev(netdev0);
With this patch, the wireless failure path avoids the reg_state
BUG_ON() in free_netdev() but still reaches this use-after-free. The
gelic_net_setup_netdev() failure path and every remove and shutdown
reach it too.
Would it make sense to call free_netdev() before kfree(card->unalign),
or to call netif_napi_del(&card->napi) before the card is freed? That
change would be needed in both the probe unwind and
ps3_gelic_driver_remove().
> }
> #endif
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204164508.2083305-1-fuwh1120%40163.com
Technical Details
Message-ID:
<179649124305.3146.2081352787535255828@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.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-378053-linux-kernel-netdev=dewy.ruReferences:
<20261204164508.2083305-1-fuwh1120@163.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.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-378053-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: ps3: Unregister Ethernet when wireless probe fails Date: Sat, 05 Dec 2026 17:20:43 +0000 Organization: Usenet Network Message-ID: <179649124305.3146.2081352787535255828@kernel.org> References: <20261204164508.2083305-1-fuwh1120@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3077300"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:WHx2RcXp1wq9R9W2H94JE1FTj5g= sha256:v/Suhuy6TsNOjpimCsU5h7h1gNBwwaL5tst/sP6nZc0= sha1:BRtSL/4rk/2dpK7yKVW9Kok7ic8= sha256:xYO0qUKKseO7FS99dcfYh3bplpi9XyrNi/YDHkJ5t+g= 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 47F76117E66; Sat, 5 Dec 2026 20:21:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.539 X-Spam-Status: No, score=-3.539 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, 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 uUDw2PIE4zsn; Sat, 5 Dec 2026 20:20:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378053-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 61903117E63; Sat, 5 Dec 2026 20:20:49 +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 719AC2E470; Sat, 5 Dec 2026 17:20:46 +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=1796491245; b=wsyh5JrFlSFXcrPx03fELlZoFHibjCiz5g3Uv1VWnLLDV1v/4X4KG99+aKmw7U4CkIks WyzYWzvjMJxAhbSbRNeeZt6unxhGy4y16g0UpKqWnAcfT5KOwge4a73VsZ+eeqg3sDGxk B9MRyV5rP3qOgV/Be4/TWOS5Vm6ygtZm3B0hvN8wPXuT/MnlEWMgE0lE5nAetbSJvNSP+ +lwYwzvSB1zN954uGyttgLagcvxueuCtwd6rcELqSRmoQndDmZ/IqpoN+xy7X2EWy/JEl hKKfd/MsWI8YwM5houQXMJTY4WICHl8PktUC8NlV4T3O+Oryyu4i1eztCcyl/BZtSsQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796491245; 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=chXBKNUtsuwNV+MoiLKi8//rixMQDv2/Av3d0oG2K2M=; b=tRO8X9FsSSv385HpxOWHuuVHMRri4VmPvwM2aqDr1uaokENVWyS1NPnPfvxcBKVL9oUH RDy8FAk4dc22+IGZHtTu6EVaByl9dDHF29AA9ZnsehaUMnn2QtD+aHoFnMnGlGeelWT6d 9JBhLqUmUCTzYGNtvQRbbCtV3cXByu6AtiDIAAysIr586Bx6ttt8LqZCR6rPl6kZM/Y64 I3s6nRebFuAoD1276Ybq9eAilyEK9pM4hEe9qco/DI3LN27sjHjNXHZg8Zl4Q4Jnwqgq8 wOC/N/E+3M2CLEDN5epw9xtQddRZV1EPyLLoRueyo1Yetc4vGT4pGI/biWBfAKC48rQ== 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=JzbQ+SBM; 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 B240D606A335; Sat, 5 Dec 2026 17:20:45 +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=JzbQ+SBM 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=1796491244; b=rSZtCKBGf6gRVfj2EjxsGcAab51JnguI7RLh4TAjtNUrZFt8yfMcly4Qyb0Ww2qoSCSh Sr0kV+31FXoJdZdCXUm9i3qxr4pe+hAAiuGN0GmmN9Poo+ecVY9Xkp1QDVSX3HYOsBWbq reHDrZa/zD8ix6oSN5LO4zemHzLL51oJ7jkZJQ3yDM+N80sodbiNmblfe0MVKBc+GfIqP ZGVOR6Iw6xkAiykhYdPPjkOeDfaqp+gP6+TiokQpiKuNYsc2GUUYQJheDi3mxuZJ4GBbz o4Be2NnDzXnP9LOcA7HSv10ddtn18dfZY8qo3opfD0/1M6gkLDPPhfElB8S8J9RgDcg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796491244; 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=chXBKNUtsuwNV+MoiLKi8//rixMQDv2/Av3d0oG2K2M=; b=EMa9LYZwc+aI4LEvnzx6XTJiCpSIAZRExBgZqPbywztYKTrPpR9G64Dgr5Cn9lM3iR8K FaiJIAUMJcWDgd4sDz7m0aKUCOuEhxLiWLg4p82RTMPgrOv/WZD/uvAdtY/yOHXgLYyHP DS/qmTY1oSW/KIP2hCwRH3Wp8E5OlZdyn2Hh7/rmKkXm88MbjJMT4IWJcjnVaoy4q0PYN zQNT+NBBBP5+kKlP/hyRcZE454BdX+teIcCPVLD3ASi0Df6w2U8L/1cVZBneSNa5EZ2Gd 4JNqfani9fCjTzf2OYNhXHxiT2BwXYRcHaEfqxFPkQ0Iut7wTChdzlCuutYv969CjHQ== 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=JzbQ+SBM; 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 CE55E606A31F for <netdev@vger.kernel.org>; Sat, 5 Dec 2026 17:20:44 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87FDA1F00936; Sat, 5 Dec 2026 17:20:43 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796491244; bh=chXBKNUtsuwNV+MoiLKi8//rixMQDv2/Av3d0oG2K2M=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JzbQ+SBMeH1QMqc8O+etaRoG0IckTaTcT0H+nhAl72effFeudbuBIa1f1C2R5Y0pj 3jF5uYp8AotcRRKs1KAnpV0nmxDeiK91zMbD+BBoroF/agQgG76mGyRednOf8HShAZ WGgYTa7pb+mOBSqaULUo9DchS5KsTm3l10QzgNeIC0ZAy28NgxRmPIe8cqFsuC9uDF mr5lwCog5Qo5wSKBGRTpDOxICg1WCZaTcf29M7ifgpAXmLvujDrcRlshLBCrhJlscH OKnTI2xWiGimVL9gusB1poQsBHxtI8VbYoPDOeL9WJViioVFvEL0Fb7QtR++k6ro1+ Z9PK8cvubm8Ag== X-Cc: geoff@infradead.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com, mokuno@sm.sony.co.jp, dcbw@redhat.com, jeff@garzik.org, linville@tuxdriver.com, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org X-In-Reply-To: <20261204164508.2083305-1-fuwh1120@163.com> X-sashiko-severity: Medium 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