public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org,
	Gabriel Krisman Bertazi <krisman@collabora.co.uk>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Avoid NULL dereference of drm_device.dev
Date: Fri, 30 Dec 2016 15:30:48 +0100	[thread overview]
Message-ID: <20161230143048.GF8712@dvetter-linux.ger.corp.intel.com> (raw)
In-Reply-To: <20161230141639.10487-1-chris@chris-wilson.co.uk>

On Fri, Dec 30, 2016 at 02:16:39PM +0000, Chris Wilson wrote:
> For a virtual device, drm_device.dev is NULL, so becareful not to
> dereference it unconditionally in core code such as drm_dev_register().
> 
> Fixes: 75f6dfe3e652 ("drm: Deduplicate driver initialization message")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

Welp, so much for assuming I don't need to CI simple core patches ... I
guess we should roll out bat CI to dri-devel asap, but for that there's
still way too much noise :(

Thanks for the quick fix, applied.
-Daniel
> ---
>  drivers/gpu/drm/drm_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 24d2949fd80b..6285e42b42da 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -767,7 +767,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>  
>  	DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
>  		 driver->name, driver->major, driver->minor,
> -		 driver->patchlevel, driver->date, dev_name(dev->dev),
> +		 driver->patchlevel, driver->date,
> +		 dev->dev ? dev_name(dev->dev) : "virtual device",
>  		 dev->primary->index);
>  
>  	goto out_unlock;
> -- 
> 2.11.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2016-12-30 14:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-30 14:16 [PATCH] drm: Avoid NULL dereference of drm_device.dev Chris Wilson
2016-12-30 14:30 ` Daniel Vetter [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=20161230143048.GF8712@dvetter-linux.ger.corp.intel.com \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=krisman@collabora.co.uk \
    /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