drm/vgem: validate vgem_device before exit operations
Subsystems (2)
PATCH 1/1 drm/vgem: validate vgem_device before exit operations
This patch adds a check for the vgem_device before handling it.
--- drivers/gpu/drm/vgem/vgem_drv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/vgem/vgem_drv.c +8 -1
@@ -472,7 +472,14 @@ static int __init vgem_init(void) static void __exit vgem_exit(void) { -struct platform_device *pdev = vgem_device->platform; +struct platform_device *pdev; + +if (!vgem_device) { +DRM_INFO ("vgem_device is NULL\n" ); +return ; + } + + pdev = vgem_device->platform;drm_dev_unregister (&vgem_device->drm);devres_release_group (&pdev->dev,NULL );
Signature · 6 lines
2.28.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Melissa Wen
This patch adds a check for the
vgem_devicebefore handling it.Signed-off-by Melissa Wen <[email protected]>
Seems reasonable. Reviewed-by: Daniel Vetter <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/vgem/vgem_drv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/gpu/drm/vgem/vgem_drv.c +8
-2@@ -472,7 +472,14 @@ static int __init vgem_init(void) static void __exit vgem_exit(void) { -struct platform_device *pdev = vgem_device->platform; +struct platform_device *pdev; + +if (!vgem_device) { +DRM_INFO ("vgem_device is NULL\n" ); +return ; + } + + pdev = vgem_device->platform;drm_dev_unregister (&vgem_device->drm);devres_release_group (&pdev->dev,NULL ); --2.28.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Melissa Wen
Sent: Thursday, September 17, 2020 10:22 AM
To: Daniel Vetter <[email protected]>; David Airlie <[email protected]>
Cc: [email protected]
Subject: [PATCH] drm/vgem: validatevgem_devicebefore exit operationsThis patch adds a check for the
vgem_devicebefore handling it.Signed-off-by Melissa Wen <[email protected]>---
drivers/gpu/drm/vgem/vgem_drv.c| 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)drivers/gpu/drm/vgem/vgem_drv.c +0
-0
drivers/gpu/drm/vgem/vgem_drv.c static int __init vgem_init(void) · line 480
Quoted 10 lines
drivers/gpu/drm/vgem/vgem_drv.c +6
-1@@ -472,7 +472,14 @@ static int __init vgem_init(void) static void __exit vgem_exit(void) { -struct platform_device *pdev = vgem_device->platform; +struct platform_device *pdev; + +if (!vgem_device) { +DRM_INFO ("vgem_device is NULL\n" ); +return ; + }
This only gets called on module_exit.
If module_init fails, (which is where this is allocated), will the exit ever be called?
M
Quoted 8 lines
drivers/gpu/drm/vgem/vgem_drv.c +2
-1+ + pdev = vgem_device->platform;drm_dev_unregister (&vgem_device->drm);devres_release_group (&pdev->dev,NULL ); --2.28.0
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel