public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: fix nvkm_device leak on aperture removal failure
@ 2026-04-11  6:29 David Carlier
  2026-04-15 22:14 ` Danilo Krummrich
  0 siblings, 1 reply; 2+ messages in thread
From: David Carlier @ 2026-04-11  6:29 UTC (permalink / raw)
  To: dakr, lyude
  Cc: mripard, maarten.lankhorst, tzimmermann, airlied, simona, bskeggs,
	dri-devel, nouveau, stable, linux-kernel, David Carlier

When aperture_remove_conflicting_pci_devices() fails during probe, the
error path returns directly without unwinding the nvkm_device that was
just allocated by nvkm_device_pci_new(). This leaks both the device
wrapper and the pci_enable_device() reference taken inside it.

Jump to the existing fail_nvkm label so nvkm_device_del() runs and
balances both. The leak was introduced when the intermediate
nvkm_device_del() between detection and aperture removal was dropped
in favor of creating the pci device once.

Fixes: c0bfe34330b5 ("drm/nouveau: create pci device once")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 5d8475e4895e..517ff2c31dce 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -875,7 +875,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 	/* Remove conflicting drivers (vesafb, efifb etc). */
 	ret = aperture_remove_conflicting_pci_devices(pdev, driver_pci.name);
 	if (ret)
-		return ret;
+		goto fail_nvkm;
 
 	pci_set_master(pdev);
 
-- 
2.53.0


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

* Re: [PATCH] drm/nouveau: fix nvkm_device leak on aperture removal failure
  2026-04-11  6:29 [PATCH] drm/nouveau: fix nvkm_device leak on aperture removal failure David Carlier
@ 2026-04-15 22:14 ` Danilo Krummrich
  0 siblings, 0 replies; 2+ messages in thread
From: Danilo Krummrich @ 2026-04-15 22:14 UTC (permalink / raw)
  To: David Carlier
  Cc: dakr, lyude, mripard, maarten.lankhorst, tzimmermann, airlied,
	simona, bskeggs, dri-devel, nouveau, stable, linux-kernel

On Sat, 11 Apr 2026 07:29:38 +0100, David Carlier wrote:
> [PATCH] drm/nouveau: fix nvkm_device leak on aperture removal failure

Applied, thanks!

  Branch: drm-misc-fixes
  Tree:   https://gitlab.freedesktop.org/drm/misc/kernel.git

[1/1] drm/nouveau: fix nvkm_device leak on aperture removal failure
      commit: 6597ff1d8de3

The patch will appear in the next linux-next integration (typically within 24
hours on weekdays.)

The patch is queued up for Linus's tree and should land in the next -rc release.

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

end of thread, other threads:[~2026-04-15 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11  6:29 [PATCH] drm/nouveau: fix nvkm_device leak on aperture removal failure David Carlier
2026-04-15 22:14 ` Danilo Krummrich

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