Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: fix NULL deref in the load detect code
Date: Fri, 14 Feb 2014 08:11:36 -0800	[thread overview]
Message-ID: <20140214081136.7652804a@jbarnes-desktop> (raw)
In-Reply-To: <1392392154-3479-1-git-send-email-daniel.vetter@ffwll.ch>

On Fri, 14 Feb 2014 16:35:54 +0100
Daniel Vetter <daniel.vetter@ffwll.ch> wrote:

> Looks like I've missed one of the potential NULL deref bugs in Jesse's
> fbdev->fb embedded struct to pointer conversions. Fix it up.
> 
> This regression has been introduced in
> 
> commit 8bcd45534ddf68ab71aeed709dacd9cf65dc0f75
> Author: Jesse Barnes <jbarnes@virtuousgeek.org>
> Date:   Fri Feb 7 12:10:38 2014 -0800
> 
>     drm/i915: alloc intel_fb in the intel_fbdev struct
> 
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0d3f2a5f4d2d..f19e6ea36dc4 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -7754,13 +7754,15 @@ mode_fits_in_fbdev(struct drm_device *dev,
>  	struct drm_i915_gem_object *obj;
>  	struct drm_framebuffer *fb;
>  
> -	if (dev_priv->fbdev == NULL)
> +	if (!dev_priv->fbdev)
>  		return NULL;
>  
> -	obj = dev_priv->fbdev->fb->obj;
> -	if (obj == NULL)
> +	if (!dev_priv->fbdev->fb)
>  		return NULL;
>  
> +	obj = dev_priv->fbdev->fb->obj;
> +	BUG_ON(!obj);
> +
>  	fb = &dev_priv->fbdev->fb->base;
>  	if (fb->pitches[0] < intel_framebuffer_pitch_for_width(mode->hdisplay,
>  							       fb->bits_per_pixel))

ah yep, good catch.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

      reply	other threads:[~2014-02-14 16:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 15:35 [PATCH] drm/i915: fix NULL deref in the load detect code Daniel Vetter
2014-02-14 16:11 ` Jesse Barnes [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=20140214081136.7652804a@jbarnes-desktop \
    --to=jbarnes@virtuousgeek.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /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