Skip to contentSkip to conversation

fbdev: savage: fix probe-path EDID cleanup leaks

PATCH In review Yuho Choi 1 participant 3 messages Apr 20 – May 5

Subsystems (2)
lore
Share & tools
lore

Yuho Choi

author
#0 lore raw

PATCH 1/1 fbdev: savage: fix probe-path EDID cleanup leaks

When CONFIG_FB_SAVAGE_I2C is enabled, savagefb_probe() can build both an EDID-derived monspecs.modedb and a modelist from it before later failing.

The normal success path frees monspecs.modedb after the initial mode selection, but the probe error path only deletes the I2C busses and misses the EDID-derived allocations.

Free both the modelist and monspecs.modedb on the failed: unwind path.

---
 drivers/video/fbdev/savage/savagefb_driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/savage/savagefb_driver.c +2 -0
index ac41f8f37589f..c2f79357c8da0 100644
@@ -2322,6 +2322,8 @@ static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id)
  failed:
 #ifdef CONFIG_FB_SAVAGE_I2C
 	savagefb_delete_i2c_busses(info);
+	fb_destroy_modelist(&info->modelist);
+	fb_destroy_modedb(info->monspecs.modedb);
 #endif
 	fb_alloc_cmap(&info->cmap, 0, 0);
 	savage_unmap_video(info);
Signature · 1 line
2.50.1 (Apple Git-155)
author
#1 lore raw

Dear Antonino and Helge,

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

Best regards,
Yuho

Quoted 38 lines · Yuho Choi

When CONFIG_FB_SAVAGE_I2C is enabled, savagefb_probe() can build both an EDID-derived monspecs.modedb and a modelist from it before later failing.

The normal success path frees monspecs.modedb after the initial mode selection, but the probe error path only deletes the I2C busses and misses the EDID-derived allocations.

Free both the modelist and monspecs.modedb on the failed: unwind path.

---
 drivers/video/fbdev/savage/savagefb_driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/savage/savagefb_driver.c +2 -1
index ac41f8f37589f..c2f79357c8da0 100644
@@ -2322,6 +2322,8 @@ static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id)
  failed:
 #ifdef CONFIG_FB_SAVAGE_I2C
        savagefb_delete_i2c_busses(info);
+       fb_destroy_modelist(&info->modelist);
+       fb_destroy_modedb(info->monspecs.modedb);
 #endif
        fb_alloc_cmap(&info->cmap, 0, 0);
        savage_unmap_video(info);
--

2.50.1 (Apple Git-155)

#2 lore raw

PATCH 1/1 fbdev: savage: fix probe-path EDID cleanup leaks

In reply to Yuho Choi

Hi Antonino and Helge,

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

Best regards,
Yuho Choi