dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
To: Melissa Wen <melissa.srw@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>
Cc: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: RE: [PATCH] drm/vgem: validate vgem_device before exit operations
Date: Thu, 17 Sep 2020 14:39:38 +0000	[thread overview]
Message-ID: <be357808ee34469dbbe06738c4928546@intel.com> (raw)
In-Reply-To: <20200917142145.ipcxb2zo4up357t2@smtp.gmail.com>

>-----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

      parent reply	other threads:[~2020-09-17 14:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be357808ee34469dbbe06738c4928546@intel.com \
    --to=michael.j.ruhl@intel.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=melissa.srw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox