All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: fbdev: fix potential NULL pointer dereferences
@ 2019-03-14  7:33   ` Kangjie Lu
  0 siblings, 0 replies; 4+ messages in thread
From: Kangjie Lu @ 2019-03-14  7:33 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Bartlomiej Zolnierkiewicz, Finn Thain, Rob Herring,
	Greg Kroah-Hartman, linux-fbdev, dri-devel, linux-kernel

In case ioremap fails, the fix releases resources and returns
-ENOMEM to avoid NULL pointer dereferences.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/video/fbdev/imsttfb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c
index 5d9670daf60e..2e321d73b3a5 100644
--- a/drivers/video/fbdev/imsttfb.c
+++ b/drivers/video/fbdev/imsttfb.c
@@ -1515,6 +1515,11 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	info->fix.smem_start = addr;
 	info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ?
 					    0x400000 : 0x800000);
+	if (!info->screen_base) {
+		release_mem_region(addr, size);
+		framebuffer_release(info);
+		return -ENOMEM;
+	}
 	info->fix.mmio_start = addr + 0x800000;
 	par->dc_regs = ioremap(addr + 0x800000, 0x1000);
 	par->cmap_regs_phys = addr + 0x840000;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] video: fbdev: fix potential NULL pointer dereferences
@ 2019-03-14  7:33   ` Kangjie Lu
  0 siblings, 0 replies; 4+ messages in thread
From: Kangjie Lu @ 2019-03-14  7:33 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Bartlomiej Zolnierkiewicz, Finn Thain, Rob Herring,
	Greg Kroah-Hartman, linux-fbdev, dri-devel, linux-kernel

In case ioremap fails, the fix releases resources and returns
-ENOMEM to avoid NULL pointer dereferences.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/video/fbdev/imsttfb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c
index 5d9670daf60e..2e321d73b3a5 100644
--- a/drivers/video/fbdev/imsttfb.c
+++ b/drivers/video/fbdev/imsttfb.c
@@ -1515,6 +1515,11 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	info->fix.smem_start = addr;
 	info->screen_base = (__u8 *)ioremap(addr, par->ramdac = IBM ?
 					    0x400000 : 0x800000);
+	if (!info->screen_base) {
+		release_mem_region(addr, size);
+		framebuffer_release(info);
+		return -ENOMEM;
+	}
 	info->fix.mmio_start = addr + 0x800000;
 	par->dc_regs = ioremap(addr + 0x800000, 0x1000);
 	par->cmap_regs_phys = addr + 0x840000;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] video: fbdev: fix potential NULL pointer dereferences
  2019-03-14  7:33   ` Kangjie Lu
@ 2019-04-01 14:42     ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-04-01 14:42 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Finn Thain, Rob Herring, Greg Kroah-Hartman,
	linux-fbdev, dri-devel, linux-kernel


On 03/14/2019 08:33 AM, Kangjie Lu wrote:
> In case ioremap fails, the fix releases resources and returns
> -ENOMEM to avoid NULL pointer dereferences.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Patch queued for v5.2 with minor change in the patch summary
("video: imsttfb: fix potential NULL pointer dereference"), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] video: fbdev: fix potential NULL pointer dereferences
@ 2019-04-01 14:42     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-04-01 14:42 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Finn Thain, Rob Herring, Greg Kroah-Hartman,
	linux-fbdev, dri-devel, linux-kernel


On 03/14/2019 08:33 AM, Kangjie Lu wrote:
> In case ioremap fails, the fix releases resources and returns
> -ENOMEM to avoid NULL pointer dereferences.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Patch queued for v5.2 with minor change in the patch summary
("video: imsttfb: fix potential NULL pointer dereference"), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-01 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190314073330epcas5p3ac243599bdd87be63b94f9d75b396a9e@epcas5p3.samsung.com>
2019-03-14  7:33 ` [PATCH] video: fbdev: fix potential NULL pointer dereferences Kangjie Lu
2019-03-14  7:33   ` Kangjie Lu
2019-04-01 14:42   ` Bartlomiej Zolnierkiewicz
2019-04-01 14:42     ` Bartlomiej Zolnierkiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.