public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: nvec: fix unconditional pm_power_off teardown
       [not found] <20260413151236.612404-1-hossu.alexandru@gmail.com>
@ 2026-04-13 20:02 ` Alexandru Hossu
  2026-04-26 19:04   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandru Hossu @ 2026-04-13 20:02 UTC (permalink / raw)
  To: gregkh
  Cc: linux-staging, linux-kernel, error27, linux-tegra, marvin24,
	Alexandru Hossu

tegra_nvec_remove() unconditionally sets pm_power_off = NULL, even if
nvec was not the one that registered it. This breaks any other driver
that may have set pm_power_off to its own handler.

Replace the unconditional assignment with a guarded check so that
pm_power_off is only cleared if nvec was the one that set it.

Also remove the stale FIXME comment, as the guard addresses exactly
what it was asking for.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
---
v3:
 - Drop incorrect Fixes tag

v2:
 - Drop nvec_power_handle = NULL; after pm_power_off is cleared,
   nvec_power_off() is unreachable via pm_power_off so there is no
   dangling-pointer risk (Dan Carpenter)

 drivers/staging/nvec/nvec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 2a3499dd4d63..88c416ee0381 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -906,8 +906,8 @@ static void tegra_nvec_remove(struct platform_device *pdev)
 	nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
 	cancel_work_sync(&nvec->rx_work);
 	cancel_work_sync(&nvec->tx_work);
-	/* FIXME: needs check whether nvec is responsible for power off */
-	pm_power_off = NULL;
+	if (pm_power_off == nvec_power_off)
+		pm_power_off = NULL;
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] staging: nvec: fix unconditional pm_power_off teardown
  2026-04-13 20:02 ` [PATCH v3] staging: nvec: fix unconditional pm_power_off teardown Alexandru Hossu
@ 2026-04-26 19:04   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-04-26 19:04 UTC (permalink / raw)
  To: Alexandru Hossu
  Cc: linux-staging, linux-kernel, error27, linux-tegra, marvin24

On Mon, Apr 13, 2026 at 10:02:03PM +0200, Alexandru Hossu wrote:
> tegra_nvec_remove() unconditionally sets pm_power_off = NULL, even if
> nvec was not the one that registered it. This breaks any other driver
> that may have set pm_power_off to its own handler.
> 
> Replace the unconditional assignment with a guarded check so that
> pm_power_off is only cleared if nvec was the one that set it.
> 
> Also remove the stale FIXME comment, as the guard addresses exactly
> what it was asking for.
> 
> Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
> ---
> v3:
>  - Drop incorrect Fixes tag

I'm confused, I see lots of different patches here, with this final
thread looking like this:

 Apr 13 Alexandru Hossu (  51) [PATCH v2 1/2] staging: nvec: fix use-after-free in nvec_rx_completed()
 Apr 13 Alexandru Hossu (  40) └─>[PATCH v2 2/2] staging: nvec: fix unconditional pm_power_off teardown
 Apr 13 Dan Carpenter   (  26)   ├─>
 Apr 13 Alexandru Hossu (  42)   └─>[PATCH v3] staging: nvec: fix unconditional pm_power_off teardown

What is patch v3 of?  What about patch 1/2?

This is really confusing.

When redoing a patch in a series, you need to resend the whole series as
a new version.  Otherwise I have no idea what to do (and our tools get
_VERY_ confused as well.)

So a v4 full series please?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-27  3:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260413151236.612404-1-hossu.alexandru@gmail.com>
2026-04-13 20:02 ` [PATCH v3] staging: nvec: fix unconditional pm_power_off teardown Alexandru Hossu
2026-04-26 19:04   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox