🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21485

Re: [PATCH net v7 2/6] net: wwan: t7xx: fix runtime PM usage count underflow on -EACCES

#21485
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 02:29
153 lines
13894 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 (1) · Low: 1

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] At this commit, t7xx_cldma_send_skb()
  (drivers/net/wwan/t7xx/t7xx_hif_cldma.c) still has the bug this patch…
- [Low] net: wwan: t7xx: inaccurate Fixes tag citing 46e8f49ed7b3 for
  runtime PM bug

Pre-existing issues:
- [Medium] t7xx_dpmaif_irq_rx_done() takes a runtime PM reference and
  hands it to the NAPI poll by calling napi_schedule(&rxq->napi).

--

net: wwan: t7xx: fix runtime PM usage count underflow on -EACCES

This commit replaces pm_runtime_resume_and_get() with
pm_runtime_get_noresume() plus pm_runtime_resume() in four DPMAIF TX/RX
contexts. A usage count reference is now still held when -EACCES is
treated as success. The reference is dropped with pm_runtime_put_noidle()
only on errors that abort the operation.

> t7xx_dpmaif_tx_hw_push_thread(), t7xx_dpmaif_tx_done(),
> t7xx_dpmaif_bat_release_work() and t7xx_dpmaif_irq_rx_done() treat
> -EACCES from pm_runtime_resume_and_get() as success and proceed to
> access the hardware.

[Severity: Medium]
Was a fifth caller with the same pattern left out here? At this commit,
t7xx_cldma_send_skb() in drivers/net/wwan/t7xx/t7xx_hif_cldma.c still
does:

drivers/net/wwan/t7xx/t7xx_hif_cldma.c:t7xx_cldma_send_skb() {
    ...
	ret = pm_runtime_resume_and_get(md_ctrl->dev);
	if (ret < 0 && ret != -EACCES)
		return ret;
    ...
allow_sleep:
	t7xx_pci_enable_sleep(md_ctrl->t7xx_dev);
	pm_runtime_put_autosuspend(md_ctrl->dev);
	return ret;
}

On the -EACCES path, pm_runtime_resume_and_get() has already given back
its reference. Every exit then goes through allow_sleep, so wouldn't the
pm_runtime_put_autosuspend() there drop a reference that was never
taken? The path is t7xx_port_wwan_write() or t7xx_port_fastboot_write()
-> t7xx_cldma_send_skb().

The next patch in the series, "net: wwan: t7xx: fix skb double free when
CLDMA send sees -EACCES", converts this site to the same
pm_runtime_get_noresume() + pm_runtime_resume() pattern. So the end of
the series looks correct.

Could the CLDMA conversion be folded into this patch, or at least
mentioned in the commit message? Then this commit would fully fix the
underflow it describes.

> diff --git a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
> index 5af90ca6e0631..77770869d5750 100644
> --- a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
> +++ b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
> @@ -911,8 +911,10 @@ void t7xx_dpmaif_irq_rx_done(struct dpmaif_ctrl *dpmaif_ctrl, const unsigned int
>  	 * which can't be done from softirq context the poll function
>  	 * is running in.
>  	 */
> -	ret = pm_runtime_resume_and_get(ctrl->dev);
> +	pm_runtime_get_noresume(ctrl->dev);
> +	ret = pm_runtime_resume(ctrl->dev);
>  	if (ret < 0 && ret != -EACCES) {
> +		pm_runtime_put_noidle(ctrl->dev);
>  		dev_err(ctrl->dev, "Failed to resume device: %d\n", ret);
>  		return;
>  	}

[Severity: Low]
Is the Fixes: tag pointing at the right commit? 46e8f49ed7b3
("net: wwan: t7xx: Introduce power management") only added the system
sleep dev_pm_ops callbacks (suspend, resume, freeze, thaw, poweroff,
restore) and the PM entity registration. It does not add any runtime
PM calls, and it does not touch t7xx_hif_dpmaif_rx.c or
t7xx_hif_dpmaif_tx.c.

The pm_runtime_resume_and_get() calls that ignore -EACCES and are then
paired with an unconditional pm_runtime_put_autosuspend() look like
they came from two later commits:

  d10b3a695ba0 ("net: wwan: t7xx: Runtime PM")
    t7xx_dpmaif_bat_release_work(), t7xx_dpmaif_tx_done() and
    t7xx_dpmaif_tx_hw_push_thread()

  364d0221f178 ("net: wwan: t7xx: Fix Runtime PM resume sequence")
    t7xx_dpmaif_irq_rx_done()

Should the trailers cite those two commits instead? The stable
tooling uses Fixes: to decide which trees need this patch. Anyone
running git blame later would also be sent to a commit that has
nothing to do with the usage count underflow.

[Severity: Medium]
This is a pre-existing issue and was not introduced by this patch. The
reference taken here is passed on to the NAPI poll right after this
block:

	napi_schedule(&rxq->napi);

The return value is ignored. If NAPI_STATE_SCHED is already set,
napi_schedule() does nothing. In that case t7xx_dpmaif_napi_rx_poll()
never reaches the pm_runtime_put_autosuspend() that would drop this
reference.

Can this leak the runtime PM usage count and keep the modem from
runtime suspending?

SCHED can stay set in two ways. The first is a closed netdev, while
DPMAIF RX-done interrupts can still arrive:

t7xx_ccmni_close()
  t7xx_ccmni_disable_napi()
    napi_disable()

The second is the !rxq->que_started early return in
t7xx_dpmaif_napi_rx_poll(), which returns without calling
napi_complete_done():

	if (!rxq->que_started) {
		atomic_set(&rxq->rx_processing, 0);
		pm_runtime_put_autosuspend(rxq->dpmaif_ctrl->dev);
		dev_err(...);
		return work_done;
	}

The same leak already existed on the normal success path before this
patch. This patch adds the same handoff on the -EACCES path.

The que_started part is fixed later in the series by "net: wwan: t7xx:
complete NAPI on the not-started RX poll early return", which adds
napi_complete_done() to that early return.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120015556.131547-1-tim770802%40gmail.com
Technical Details
Message-ID: <179548737758.3135.16325622111996411281@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369969-linux-kernel-netdev=dewy.ru
References: <20261120015556.131547-3-tim770802@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369969-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v7 2/6] net: wwan: t7xx: fix runtime PM usage count underflow on -EACCES
Date: Tue, 24 Nov 2026 02:29:37 +0000
Organization: Usenet Network
Message-ID: <179548737758.3135.16325622111996411281@kernel.org>
References: <20261120015556.131547-3-tim770802@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="4035040"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gm2snoDgZs/ib4wTThV3eO04VxM= sha256:H9lKv44CjddQzSNHd/mKSWonyO2U6PbntkVtExg4IDA= sha1:0yIGN4vngfujniUg07zPH60xw6I= sha256:Z+Pk8PKWq3aJjLJub1I5xRIdT1McRg9Wn0D8waHKAKE=
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 BB11A125DCB; Tue, 24 Nov 2026 05:29:57 +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 gPgl5E-40330; Tue, 24 Nov 2026 05:29:53 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369969-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 9386D125DC7; Tue, 24 Nov 2026 05:29:43 +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 B463533BF4; Tue, 24 Nov 2026 02:29:41 +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=1795487380; b=huUgYOOgkbTKUgdd6qqhpYkhFVhYYkPwZ2FDOSRgH2m7G9trD1yE2EBvx9WTBqU2LHj6 FoL32Mdj8PkZyj74veIs9yew1dF3td/T4BkXgRy5kWR69Oovzbsx/GsPOV0ATHMFFNG4R YkrYa+nONEE8G4BYW9tPEv/+IL8QjntkeXLZ1YghoHvg4wkhomLYlvzuEw0mP5/0JKzw1 VR13a2e3tW/TbylPb28+fFJudF0buOUvyGOnHF0EF97/ddkRczdcxPcmN84sLk2PnX7Jt vhbytq2KHFtCAk58YavEEeB1NZtHouYmAiz2rnWX7iP/XwOeBAs5rSKqqBdEcahf3fA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795487380; 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=8NvDqIrKXQ3eal5Cp0jr6Hk9FP8h4weYBqykTLZjvkg=; b=c44SYwDLUDHPRcWT/9YN8m1AIHhLFihI3UKp20ySAnuFah5MVeFWkeD40Vy08BkDhvKW prwiKKsKRxoCVWzQu8iZd5h6n5cjMREzWG11hHXNzPP5vcft5mhDorvtsc4Vx2ICnKtAM 5QSZYIn85Xdhdgf1tkzWH1go1pRHkPVcbfMj/x+yHHGmgheC8U2Ig0Oe+w90aDW+BYmr6 4iU5IsK5jh/DyyYA1jHV1UXkJkz95FtLTce4mDjJZEN2PxMZRtXIkhOKJGsDhPFUqilCK 7V72sBEWCObCSFQCxzbjkocv8GlXWGAYwLMcvDexmS1/VxzVvYdFCPR2I1t28CvMqxQ==
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=f+jgVsxj; 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 A4724606A333; Tue, 24 Nov 2026 02:29:40 +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=f+jgVsxj
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=1795487379; b=jbI1pgnBGOgimxBmZg7RnYJfMrLYUWYl1gv5qpM2dFZyhQ+qbyCgSWUXDxjs+nIo8jYp FiYkAmBYNFrNzMNN3GQ1KfUDkKYz6eE4zbZ7nA0dajx/ogYB+NRvEbuuVc2XYVYyIhWiQ IU5/4GPzYGdZiMMarVf7CNcUupW2g/lVfcG6Rpfz+uA+B8ERWzNg9K/XpqM3kzbMLaHfd PfIQg7NmilEsR4pQsmO/2/mgCJZKkOGGTrhoPdeDq63xjiqBS3Wz6Ju+BkkP40LB0eHlf NHdHENyT8OZWYO/bQefD0mTTTT+gIt37TF06LtCGKmG6PP9bq+Tf1wt5rKrv9HATI8w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795487379; 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=8NvDqIrKXQ3eal5Cp0jr6Hk9FP8h4weYBqykTLZjvkg=; b=4f9JphXynmeDxpeXB6cbmwHEfnVFetDtJ2n/brI+2r191Hlf3rZq4tgzOiWBXblsoBCS rHsejf/XGcZOII3ZzE/zqWTecfDtKIPlNvG22c4eDrbZDrD4q+gOWDLhoZiKFU2xO6G6a fN+7AtlGgEOrl64bqYjwo9aoGfEdpPjFOFRXIo29r656404y1Tn24hbZOTDihSaye3dGK Buf7eqjUKWeqMSita6jKzaVIiUZwFNg7NDQKpzak4avSKVxFpB+q2+VHFxHg89Tk44ZB0 VdOnwIt1uD+0KGYIxaTufQKWxrnM9a6RGN5KtJucmx8cj2EK0kfqINhjRwggEnjCx0A==
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=f+jgVsxj; 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 BE77E606A31E; Tue, 24 Nov 2026 02:29:39 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16D081F000CA; Tue, 24 Nov 2026 02:29:38 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795487379; bh=8NvDqIrKXQ3eal5Cp0jr6Hk9FP8h4weYBqykTLZjvkg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=f+jgVsxjp8mHuxBkzR7gtZ5ZFii3zHj/Vnf7rMjL1hpqnoVPzBxnROTETcd/Xa6WE jfZbixfKit3yNUUs/ayq3l8klvIpDznn8ggf6NUAE5LY1LuvrpGiKZ38FDDISj4Czv WDQ7ACcfL97lANMUYoIXa3aeCoJnjRBZzaTnlHUFzbjQma/izzyiHCwUGvmkP+2R1V /JQk8zRTSV7vcdfC3HodkbjS8rz2YwFOl7/uPABUEktKr24unr+pN4Q/Zrv6onDTHG 5upHMdsbcxspjxDe3Vu4BJXhPImnvqHWsxXE8399FdCYCVo1tVpLhUjtSDKX0A3d8/ txHN8K4FlMbfQ==
X-Cc: netdev@vger.kernel.org, chandrashekar.devegowda@intel.com, haijun.liu@mediatek.com, ricardo.martinez@linux.intel.com, loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com, johannes@sipsolutions.net, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, ilpo.jarvinen@linux.intel.com, sreehari.kancharla@linux.intel.com, m.chetan.kumar@linux.intel.com, horms@kernel.org, linux-kernel@vger.kernel.org, tim.jh.chen@wnc.com.tw, Chih.Hung.Huang@wnc.com.tw
X-In-Reply-To: <20261120015556.131547-3-tim770802@gmail.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