Skip to content

Commit

Permalink
drm: crtc: integer overflow in drm_property_create_blob()
Browse files Browse the repository at this point in the history
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: f453ba0 ('DRM: add mode setting support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Cc: stable@kernel.org # v4.2
Signed-off-by: Dave Airlie <airlied@gmail.com>
  • Loading branch information
Dan Carpenter authored and Dave Airlie committed Oct 31, 2015
1 parent 04ccb89 commit 9ac0934
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4105,7 +4105,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
struct drm_property_blob *blob;
int ret;

if (!length)
if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
return ERR_PTR(-EINVAL);

blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
Expand Down

0 comments on commit 9ac0934

Please sign in to comment.