Skip to content

Commit 9cc334c

Browse files
kengitergregkh
authored andcommitted
video: imsttfb: fix potential NULL pointer dereferences
[ Upstream commit 1d84353 ] In case ioremap fails, the fix releases resources and returns -ENOMEM to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu <[email protected]> Cc: Aditya Pakki <[email protected]> Cc: Finn Thain <[email protected]> Cc: Rob Herring <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> [b.zolnierkie: minor patch summary fixup] Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent b509b1c commit 9cc334c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/video/fbdev/imsttfb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,11 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15161516
info->fix.smem_start = addr;
15171517
info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ?
15181518
0x400000 : 0x800000);
1519+
if (!info->screen_base) {
1520+
release_mem_region(addr, size);
1521+
framebuffer_release(info);
1522+
return -ENOMEM;
1523+
}
15191524
info->fix.mmio_start = addr + 0x800000;
15201525
par->dc_regs = ioremap(addr + 0x800000, 0x1000);
15211526
par->cmap_regs_phys = addr + 0x840000;

0 commit comments

Comments
 (0)