* [PATCH] drm/vgem: validate vgem_device before exit operations
@ 2020-09-17 14:21 Melissa Wen
2020-09-17 14:30 ` Daniel Vetter
2020-09-17 14:39 ` Ruhl, Michael J
0 siblings, 2 replies; 3+ messages in thread
From: Melissa Wen @ 2020-09-17 14:21 UTC (permalink / raw)
To: Daniel Vetter, David Airlie; +Cc: dri-devel
This patch adds a check for the vgem_device before handling it.
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
---
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;
+ }
+
+ 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vgem: validate vgem_device before exit operations
2020-09-17 14:21 [PATCH] drm/vgem: validate vgem_device before exit operations Melissa Wen
@ 2020-09-17 14:30 ` Daniel Vetter
2020-09-17 14:39 ` Ruhl, Michael J
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2020-09-17 14:30 UTC (permalink / raw)
To: Melissa Wen; +Cc: David Airlie, dri-devel
On Thu, Sep 17, 2020 at 4:21 PM Melissa Wen <melissa.srw@gmail.com> wrote:
>
> This patch adds a check for the vgem_device before handling it.
>
> Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Seems reasonable. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> 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;
> + }
> +
> + pdev = vgem_device->platform;
>
> drm_dev_unregister(&vgem_device->drm);
> devres_release_group(&pdev->dev, NULL);
> --
> 2.28.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] drm/vgem: validate vgem_device before exit operations
2020-09-17 14:21 [PATCH] drm/vgem: validate vgem_device before exit operations Melissa Wen
2020-09-17 14:30 ` Daniel Vetter
@ 2020-09-17 14:39 ` Ruhl, Michael J
1 sibling, 0 replies; 3+ messages in thread
From: Ruhl, Michael J @ 2020-09-17 14:39 UTC (permalink / raw)
To: Melissa Wen, Daniel Vetter, David Airlie; +Cc: dri-devel@lists.freedesktop.org
>-----Original Message-----
>From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
>Melissa Wen
>Sent: Thursday, September 17, 2020 10:22 AM
>To: Daniel Vetter <daniel@ffwll.ch>; David Airlie <airlied@linux.ie>
>Cc: dri-devel@lists.freedesktop.org
>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@gmail.com>
>---
> 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@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-17 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17 14:21 [PATCH] drm/vgem: validate vgem_device before exit operations Melissa Wen
2020-09-17 14:30 ` Daniel Vetter
2020-09-17 14:39 ` Ruhl, Michael J
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.