RE: [PATCH] drm/vgem: validate vgem_device before exit operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: dri-devel <dri-devel-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of
>Melissa Wen
>Sent: Thursday, September 17, 2020 10:22 AM
>To: Daniel Vetter <daniel@xxxxxxxx>; David Airlie <airlied@xxxxxxxx>
>Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
>Subject: [PATCH] drm/vgem: validate vgem_device before exit operations
>
>This patch adds a check for the vgem_device before handling it.
>
>Signed-off-by: Melissa Wen <melissa.srw@xxxxxxxxx>
>---
> drivers/gpu/drm/vgem/vgem_drv.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/vgem/vgem_drv.c
>b/drivers/gpu/drm/vgem/vgem_drv.c
>index cb884c890065..119ca887cb8a 100644
>--- a/drivers/gpu/drm/vgem/vgem_drv.c
>+++ b/drivers/gpu/drm/vgem/vgem_drv.c
>@@ -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


>+
>+	pdev = vgem_device->platform;
>
> 	drm_dev_unregister(&vgem_device->drm);
> 	devres_release_group(&pdev->dev, NULL);
>--
>2.28.0
>
>_______________________________________________
>dri-devel mailing list
>dri-devel@xxxxxxxxxxxxxxxxxxxxx
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux