Skip to content

Commit 6597ff1

Browse files
devnexenDanilo Krummrich
authored andcommitted
drm/nouveau: fix nvkm_device leak on aperture removal failure
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: c0bfe34 ("drm/nouveau: create pci device once") Cc: stable@vger.kernel.org Signed-off-by: David Carlier <devnexen@gmail.com> Link: https://patch.msgid.link/20260411062938.22925-1-devnexen@gmail.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent d33db95 commit 6597ff1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
874874
/* Remove conflicting drivers (vesafb, efifb etc). */
875875
ret = aperture_remove_conflicting_pci_devices(pdev, driver_pci.name);
876876
if (ret)
877-
return ret;
877+
goto fail_nvkm;
878878

879879
pci_set_master(pdev);
880880

0 commit comments

Comments
 (0)