drm/nouveau: fix nvkm_device leak on aperture removal failure
Subsystems (4)
PATCH 1/1 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.
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +1 -1
@@ -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);
Signature · 1 line
2.53.0
Quoted 1 line · David Carlier
[PATCH] drm/nouveau: fix
nvkm_deviceleak 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.