All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: xuemin.su@intel.com, yanmin_zhang@linux.intel.com, bo.he@intel.com
Subject: Re: [PATCH V3] drm_crtc: check if fb_create return NULL
Date: Thu, 24 Jan 2013 10:31:48 +0200	[thread overview]
Message-ID: <87bocfugln.fsf@intel.com> (raw)
In-Reply-To: <1358987804.18561.22.camel@suxuemin.sh.intel.com>

On Thu, 24 Jan 2013, "Su, Xuemin" <xuemin.su@intel.com> wrote:
> From: xueminsu <xuemin.su@intel.com>
> Date: Tue, 22 Jan 2013 22:39:39 +0800
> Subject: [PATCH] drm_crtc: check if fb_create return NULL
>
> Some buggy driver may still return NULL in fb_create,
> which leads to kernel panic.
>
> Signed-off-by: xueminsu <xuemin.su@intel.com>
> ---
>  drivers/gpu/drm/drm_crtc.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f2d667b..ae613ec 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2172,6 +2172,8 @@ int drm_mode_addfb(struct drm_device *dev,
>  		ret = PTR_ERR(fb);
>  		goto out;
>  	}
> +	/* some buggy driver may return NULL here, which may cause panic */
> +	BUG_ON(!fb);

I fail to see the benefit of this compared to just letting it oops...

>  	or->fb_id = fb->base.id;

...right here.


BR,
Jani.

>  	list_add(&fb->filp_head, &file_priv->fbs);
> -- 
> 1.7.6
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Su\, Xuemin" <xuemin.su@intel.com>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: xuemin.su@intel.com, yanmin_zhang@linux.intel.com, bo.he@intel.com
Subject: Re: [PATCH V3] drm_crtc: check if fb_create return NULL
Date: Thu, 24 Jan 2013 10:31:48 +0200	[thread overview]
Message-ID: <87bocfugln.fsf@intel.com> (raw)
In-Reply-To: <1358987804.18561.22.camel@suxuemin.sh.intel.com>

On Thu, 24 Jan 2013, "Su, Xuemin" <xuemin.su@intel.com> wrote:
> From: xueminsu <xuemin.su@intel.com>
> Date: Tue, 22 Jan 2013 22:39:39 +0800
> Subject: [PATCH] drm_crtc: check if fb_create return NULL
>
> Some buggy driver may still return NULL in fb_create,
> which leads to kernel panic.
>
> Signed-off-by: xueminsu <xuemin.su@intel.com>
> ---
>  drivers/gpu/drm/drm_crtc.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f2d667b..ae613ec 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2172,6 +2172,8 @@ int drm_mode_addfb(struct drm_device *dev,
>  		ret = PTR_ERR(fb);
>  		goto out;
>  	}
> +	/* some buggy driver may return NULL here, which may cause panic */
> +	BUG_ON(!fb);

I fail to see the benefit of this compared to just letting it oops...

>  	or->fb_id = fb->base.id;

...right here.


BR,
Jani.

>  	list_add(&fb->filp_head, &file_priv->fbs);
> -- 
> 1.7.6
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2013-01-24  8:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24  0:36 [PATCH V3] drm_crtc: check if fb_create return NULL Su, Xuemin
2013-01-24  8:31 ` Jani Nikula [this message]
2013-01-24  8:31   ` Jani Nikula
2013-01-24  8:46   ` Su, Xuemin
2013-01-24  9:04     ` Jani Nikula
2013-01-24  9:04       ` Jani Nikula
2013-01-31  0:55       ` Su, Xuemin
2013-01-31  8:22         ` Daniel Vetter

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=87bocfugln.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=bo.he@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xuemin.su@intel.com \
    --cc=yanmin_zhang@linux.intel.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 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.