* [PATCH V3] drm_crtc: check if fb_create return NULL
@ 2013-01-24 0:36 Su, Xuemin
2013-01-24 8:31 ` Jani Nikula
0 siblings, 1 reply; 8+ messages in thread
From: Su, Xuemin @ 2013-01-24 0:36 UTC (permalink / raw)
To: airlied, dri-devel, linux-kernel; +Cc: bo.he, xuemin.su, yanmin_zhang
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);
or->fb_id = fb->base.id;
list_add(&fb->filp_head, &file_priv->fbs);
--
1.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V3] drm_crtc: check if fb_create return NULL
2013-01-24 0:36 [PATCH V3] drm_crtc: check if fb_create return NULL Su, Xuemin
@ 2013-01-24 8:31 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2013-01-24 8:31 UTC (permalink / raw)
To: Su, Xuemin, airlied, dri-devel, linux-kernel
Cc: xuemin.su, yanmin_zhang, bo.he
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3] drm_crtc: check if fb_create return NULL
@ 2013-01-24 8:31 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2013-01-24 8:31 UTC (permalink / raw)
To: airlied, dri-devel, linux-kernel; +Cc: xuemin.su, yanmin_zhang, bo.he
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3] drm_crtc: check if fb_create return NULL
2013-01-24 8:31 ` Jani Nikula
(?)
@ 2013-01-24 8:46 ` Su, Xuemin
2013-01-24 9:04 ` Jani Nikula
-1 siblings, 1 reply; 8+ messages in thread
From: Su, Xuemin @ 2013-01-24 8:46 UTC (permalink / raw)
To: Jani Nikula; +Cc: airlied, dri-devel, linux-kernel, yanmin_zhang, bo.he
On Thu, 2013-01-24 at 10:31 +0200, Jani Nikula wrote:
> > }
> > + /* 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.
>
>
For PATCH V3, I think a BUG_ON may give the user clearer information
about the reason of panic. Easier to debug.
I submitted a PATCH V2 yesterday which gives a warning and then return
-EVAL if fb==NULL, preventing the panic. Do you think this is
acceptable?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3] drm_crtc: check if fb_create return NULL
2013-01-24 8:46 ` Su, Xuemin
@ 2013-01-24 9:04 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2013-01-24 9:04 UTC (permalink / raw)
To: Su, Xuemin; +Cc: airlied, dri-devel, linux-kernel, yanmin_zhang, bo.he
On Thu, 24 Jan 2013, "Su, Xuemin" <xuemin.su@intel.com> wrote:
> On Thu, 2013-01-24 at 10:31 +0200, Jani Nikula wrote:
>> > }
>> > + /* 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.
>>
>>
> For PATCH V3, I think a BUG_ON may give the user clearer information
> about the reason of panic. Easier to debug.
Ah, sorry, never mind, I missed Daniel's comment. The benefit of the
BUG_ON() is making it clear what's expected of the drivers.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3] drm_crtc: check if fb_create return NULL
@ 2013-01-24 9:04 ` Jani Nikula
0 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2013-01-24 9:04 UTC (permalink / raw)
To: Su, Xuemin; +Cc: bo.he, yanmin_zhang, linux-kernel, dri-devel
On Thu, 24 Jan 2013, "Su, Xuemin" <xuemin.su@intel.com> wrote:
> On Thu, 2013-01-24 at 10:31 +0200, Jani Nikula wrote:
>> > }
>> > + /* 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.
>>
>>
> For PATCH V3, I think a BUG_ON may give the user clearer information
> about the reason of panic. Easier to debug.
Ah, sorry, never mind, I missed Daniel's comment. The benefit of the
BUG_ON() is making it clear what's expected of the drivers.
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH V3] drm_crtc: check if fb_create return NULL
2013-01-24 9:04 ` Jani Nikula
(?)
@ 2013-01-31 0:55 ` Su, Xuemin
2013-01-31 8:22 ` Daniel Vetter
-1 siblings, 1 reply; 8+ messages in thread
From: Su, Xuemin @ 2013-01-31 0:55 UTC (permalink / raw)
To: Jani Nikula; +Cc: airlied, dri-devel, linux-kernel, yanmin_zhang, He, Bo
-----Original Message-----
From: Jani Nikula [mailto:jani.nikula@linux.intel.com]
Sent: Thursday, January 24, 2013 5:05 PM
To: Su, Xuemin
Cc: airlied@linux.ie; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; yanmin_zhang@linux.intel.com; He, Bo
Subject: Re: [PATCH V3] drm_crtc: check if fb_create return NULL
>Ah, sorry, never mind, I missed Daniel's comment. The benefit of the
>BUG_ON() is making it clear what's expected of the drivers.
>Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Do you think this patch is still needed?
Currently I fix a buggy function radeon_user_framebuffer_create() which returns NULL and patch is added to 3.7-stable tree.
Do you think it's also needed to do something in drm_mode_addfb()?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V3] drm_crtc: check if fb_create return NULL
2013-01-31 0:55 ` Su, Xuemin
@ 2013-01-31 8:22 ` Daniel Vetter
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2013-01-31 8:22 UTC (permalink / raw)
To: Su, Xuemin, Dave Airlie
Cc: Jani Nikula, He, Bo, yanmin_zhang, linux-kernel, dri-devel
On Thu, Jan 31, 2013 at 1:55 AM, Su, Xuemin <xuemin.su@intel.com> wrote:
> -----Original Message-----
> From: Jani Nikula [mailto:jani.nikula@linux.intel.com]
> Sent: Thursday, January 24, 2013 5:05 PM
> To: Su, Xuemin
> Cc: airlied@linux.ie; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; yanmin_zhang@linux.intel.com; He, Bo
> Subject: Re: [PATCH V3] drm_crtc: check if fb_create return NULL
>
>>Ah, sorry, never mind, I missed Daniel's comment. The benefit of the
>>BUG_ON() is making it clear what's expected of the drivers.
>
>>Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> Do you think this patch is still needed?
> Currently I fix a buggy function radeon_user_framebuffer_create() which returns NULL and patch is added to 3.7-stable tree.
> Do you think it's also needed to do something in drm_mode_addfb()?
Imo it's still useful, just to document the assumptions of the interface. Dave?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-31 8:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 0:36 [PATCH V3] drm_crtc: check if fb_create return NULL Su, Xuemin
2013-01-24 8:31 ` Jani Nikula
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
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.