On Thu, 24 Jan 2013, "Su, Xuemin" <xuemin...@intel.com> wrote:
> From: xueminsu <xuemin...@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...@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-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to