Skip to contentSkip to conversation

fbdev/offb: fix PCI device reference leak on probe failure

PATCH New Yuho Choi 2 participants 4 messages Apr 20 – May 5 Framebuffer layer

lore
Share & tools
lore

Yuho Choi

author
#0 lore raw

PATCH 1/1 fbdev/offb: fix PCI device reference leak on probe failure

offb_init_nodriver() gets a referenced PCI device with pci_get_device(). If pci_enable_device() fails, the function returns without dropping that reference.

Release the PCI device reference before returning from the pci_enable_device() failure path.

Fixes 5bda8f7b5468 ("video: fbdev: offb: Call pci_enable_device() before using the PCI VGA device")
---
 drivers/video/fbdev/offb.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/video/fbdev/offb.c +6 -1
index f85428e13996b..166b2dff36f59 100644
@@ -640,8 +640,13 @@ static void offb_init_nodriver(struct platform_device *parent, struct device_nod
 			vid = be32_to_cpup(vidp);
 			did = be32_to_cpup(didp);
 			pdev = pci_get_device(vid, did, NULL);
-			if (!pdev || pci_enable_device(pdev))
+			if (!pdev)
 				return;
+
+			if (pci_enable_device(pdev)) {
+				pci_dev_put(pdev);
+				return;
+			}
 		}
 #endif
 		/* kludge for valkyrie */
Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw

PATCH 1/1 fbdev/offb: fix PCI device reference leak on probe failure

Dear Helge and Jason,

I am sending a gentle ping on this patch. Please let me know if you have any feedback or if any changes are required.

Best regards,
Yuho Choi

author
#3 lore raw

Dear Helge,

Thanks for letting me know that the patches were merged.

Best regards,
Yuho Choi

Quoted 11 lines · Helge Deller
Quoted 2 lines · On 5/5/26 03:39, [email protected] wrote:

I am sending a gentle ping on this patch. Please let me know if you have any feedback or if any changes are required.

Both of your patches (offb and savagefb) were merged upstream 13 days ago:
https://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev.git/log/?h=fbdev-7.1-2

Usually I send "patch applied" messages, but in this case I probably forgot.

Helge