All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2020-01-03  8:10 ` wuxu.wu
  0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2020-01-03  8:10 UTC (permalink / raw)
  To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA, airlied-cv59FeDIM0c, daniel-/w4YWyX8dFk
  Cc: hushiyuan-hv44wF8Li93QT0dZR+AlfA,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	wuxu.wu-hv44wF8Li93QT0dZR+AlfA

Hi, I think there has a incorrect kfree in pcirom_init function. In
pcirom_init function priv porinter could be free only when priv != null
and priv->rom is null.

Signed-off-by: wuxu.wu <wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
 			    (priv->rom = pci_map_rom(pdev, &priv->size))) {
 				priv->pdev = pdev;
 				return priv;
+			} else {
+			    kfree(priv);
 			}
-			kfree(priv);
 		}
 		pci_disable_rom(pdev);
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2019-12-21  3:52 ` wuxu.wu
  0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2019-12-21  3:52 UTC (permalink / raw)
  To: airlied, daniel, dri-devel, bskeggs
  Cc: hushiyuan, nouveau, linux-kernel, wuxu.wu

priv porinter could be free only when priv != null and priv->rom is null.

Signed-off-by: wuxu.wu <wuxu.wu@huawei.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
 			    (priv->rom = pci_map_rom(pdev, &priv->size))) {
 				priv->pdev = pdev;
 				return priv;
+			} else {
+			    kfree(priv);
 			}
-			kfree(priv);
 		}
 		pci_disable_rom(pdev);
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init
@ 2019-12-20 14:05 ` wuxu.wu
  0 siblings, 0 replies; 9+ messages in thread
From: wuxu.wu @ 2019-12-20 14:05 UTC (permalink / raw)
  To: airlied, daniel, dri-devel, bskeggs
  Cc: hushiyuan, nouveau, linux-kernel, wuxu.wu

priv porinter could be free only when priv != null and priv->rom is null.
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 9b91da0..d776e01 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -70,8 +70,9 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
 			    (priv->rom = pci_map_rom(pdev, &priv->size))) {
 				priv->pdev = pdev;
 				return priv;
+			} else {
+			    kfree(priv);
 			}
-			kfree(priv);
 		}
 		pci_disable_rom(pdev);
 	}
-- 
2.7.4

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

end of thread, other threads:[~2020-01-04 11:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-03  8:10 [PATCH] drm/nouveau/bios: fix incorrect kfree in platform_init wuxu.wu
2020-01-03  8:10 ` wuxu.wu
     [not found] ` <1578039033-6458-1-git-send-email-wuxu.wu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-01-03 11:53   ` Roy Spliet
2020-01-03 11:58   ` Roy Spliet
     [not found]     ` <fd3273d3-5814-be43-dbec-e49bc7990705-NQbd8FSOZ1kdnm+yROfE0A@public.gmane.org>
2020-01-03 13:25       ` Wuxu (Max)
  -- strict thread matches above, loose matches on Subject: below --
2019-12-21  3:52 wuxu.wu
2019-12-21  3:52 ` wuxu.wu
2019-12-20 14:05 wuxu.wu
2019-12-20 14:05 ` wuxu.wu

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.