Commit 4aa81100 authored by Yuho Choi's avatar Yuho Choi Committed by Thomas Zimmermann
Browse files

drm/sysfb: ofdrm: fix PCI device reference leaks



display_get_pci_dev_of() gets a referenced PCI device via
pci_get_device(). Drop that reference when pci_enable_device() fails and
release it during the managed teardown path after pci_disable_device().

Without that, ofdrm leaks the pci_dev reference on both the error path
and the normal cleanup path.

Fixes: c8a17756 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers")
Co-developed-by: default avatarMyeonghun Pak <mhun512@gmail.com>
Signed-off-by: default avatarMyeonghun Pak <mhun512@gmail.com>
Co-developed-by: default avatarIjae Kim <ae878000@gmail.com>
Signed-off-by: default avatarIjae Kim <ae878000@gmail.com>
Co-developed-by: default avatarTaegyu Kim <tmk5904@psu.edu>
Signed-off-by: default avatarTaegyu Kim <tmk5904@psu.edu>
Signed-off-by: default avatarYuho Choi <dbgh9129@gmail.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patch.msgid.link/20260420002513.216-1-dbgh9129@gmail.com
parent 3d4c2268
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -350,6 +350,7 @@ static void ofdrm_pci_release(void *data)
	struct pci_dev *pcidev = data;

	pci_disable_device(pcidev);
	pci_dev_put(pcidev);
}

static int ofdrm_device_init_pci(struct ofdrm_device *odev)
@@ -375,6 +376,7 @@ static int ofdrm_device_init_pci(struct ofdrm_device *odev)
	if (ret) {
		drm_err(dev, "pci_enable_device(%s) failed: %d\n",
			dev_name(&pcidev->dev), ret);
		pci_dev_put(pcidev);
		return ret;
	}
	ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev);