drm_crtc: check if fb_create return NULL
Subsystems (2)
PATCH RESEND v2 1/1 drm_crtc: check if fb_create return NULL
From: xueminsu <[email protected]>
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.
--- drivers/gpu/drm/drm_crtc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +7 -0
@@ -2172,6 +2172,13 @@ 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 */ +if (!fb) { +WARN (1 ,"%pf should not return NULL." , + dev->mode_config.funcs->fb_create); + ret = -EINVAL ; + goto out; + } or->fb_id = fb->base.id;list_add (&fb->filp_head, &file_priv->fbs);
Signature · 1 line
1.7.6
Quoted 8 lines · Xuemin
From: xueminsu <[email protected]>
Date: Tue, 22 Jan 2013 22:39:39 +0800
Subject: [PATCH]drm_crtc: check iffb_createreturn NULLSome buggy driver may still return NULL in
fb_create, which leads to kernel panic.Signed-off-by xueminsu <[email protected]>
Imo just BUG_ON(!fb); and call it a day. Makes it pretty clear what's expected of the drivers.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
-----Original Message-----
Quoted 8 lines
From: Daniel Vetter [mailto:[email protected]] On Behalf Of Daniel Vetter
Sent: Wednesday, January 23, 2013 5:54 PM
To: Su, Xuemin
Cc: [email protected]; [email protected]; [email protected]; [email protected]; He, Bo
Subject: Re: [PATCH V2 RESEND]drm_crtc: check iffb_createreturn NULLImo just
BUG_ON(!fb); and call it a day. Makes it pretty clear what's expected of the drivers. -Daniel
Thanks, I will upload PATCH V3.
Xuemin