Commit 2f5b9f27 authored by Dan Carpenter's avatar Dan Carpenter Committed by Zefan Li

drm: crtc: integer overflow in drm_property_create_blob()

commit 9ac0934b 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: f453ba04 ('DRM: add mode setting support')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDaniel Stone <daniels@collabora.com>
Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent 6126604d
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment