From: Dan Carpenter Date: Thu, 29 Oct 2015 13:37:54 +0000 (+0300) Subject: drm: crtc: integer overflow in drm_property_create_blob() X-Git-Tag: v3.4.112~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f5b9f275560942c8c1a56270bb1d7c8cbd885df;p=thirdparty%2Fkernel%2Fstable.git drm: crtc: integer overflow in drm_property_create_blob() commit 9ac0934bbe52290e4e4c2a58ec41cab9b6ca8c96 upstream. The size here comes from the user via the ioctl, it is a number between 1-u32max so the addition here could overflow on 32 bit systems. Fixes: f453ba046074 ('DRM: add mode setting support') Signed-off-by: Dan Carpenter Reviewed-by: Daniel Stone Signed-off-by: Dave Airlie [lizf: Backported to 3.4: adjust context] Signed-off-by: Zefan Li --- diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index ed4b7481a865c..93c5b2fdf9b40 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2945,7 +2945,7 @@ static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev struct drm_property_blob *blob; int ret; - if (!length || !data) + if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob) || !data) return NULL; blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);