mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Fix bridge reference leak in nv1a_ram_new()
@ 2026-09-16 18:00 Wentao Liang
  2026-09-17 17:16 ` lyude
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16 18:00 UTC (permalink / raw)
  To: airlied
  Cc: dakr, dri-devel, helgaas, linux-kernel, lyude, maarten.lankhorst,
	mripard, nouveau, okaya, simona, tzimmermann, Wentao Liang,
	stable

pci_get_domain_bus_and_slot() takes a reference to the PCI device,
which is never released once the memory size has been read from its
config space.  Drop the reference before returning.

Fixes: 2fa6d6cdaf283c05 ("drm/nouveau: deprecate pci_get_bus_and_slot()")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
index 18241c6ba5fa..4d52a158f320 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
@@ -51,6 +51,8 @@ nv1a_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
 		mib = ((mem >> 4) & 127) + 1;
 	}
 
+	pci_dev_put(bridge);
+
 	return nvkm_ram_new_(&nv04_ram_func, fb, NVKM_RAM_TYPE_STOLEN,
 			     mib * 1024 * 1024, pram);
 }
-- 
2.34.1


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

* Re: [PATCH] drm/nouveau: Fix bridge reference leak in nv1a_ram_new()
  2026-09-16 18:00 [PATCH] drm/nouveau: Fix bridge reference leak in nv1a_ram_new() Wentao Liang
@ 2026-09-17 17:16 ` lyude
  0 siblings, 0 replies; 2+ messages in thread
From: lyude @ 2026-09-17 17:16 UTC (permalink / raw)
  To: Wentao Liang, airlied
  Cc: dakr, dri-devel, helgaas, linux-kernel, maarten.lankhorst,
	mripard, nouveau, okaya, simona, tzimmermann, stable

Reviewed-by: Lyude Paul <lyude@redhat.com>

Will push to drm-misc-fixes in just a moment

On Wed, 2026-09-16 at 18:00 +0000, Wentao Liang wrote:
> pci_get_domain_bus_and_slot() takes a reference to the PCI device,
> which is never released once the memory size has been read from its
> config space.  Drop the reference before returning.
> 
> Fixes: 2fa6d6cdaf283c05 ("drm/nouveau: deprecate
> pci_get_bus_and_slot()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
> index 18241c6ba5fa..4d52a158f320 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv1a.c
> @@ -51,6 +51,8 @@ nv1a_ram_new(struct nvkm_fb *fb, struct nvkm_ram
> **pram)
>  		mib = ((mem >> 4) & 127) + 1;
>  	}
>  
> +	pci_dev_put(bridge);
> +
>  	return nvkm_ram_new_(&nv04_ram_func, fb,
> NVKM_RAM_TYPE_STOLEN,
>  			     mib * 1024 * 1024, pram);
>  }


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

end of thread, other threads:[~2026-09-17 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 18:00 [PATCH] drm/nouveau: Fix bridge reference leak in nv1a_ram_new() Wentao Liang
2026-09-17 17:16 ` lyude

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

all inboxes | Powered by JetHome®