]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm: crtc: integer overflow in drm_property_create_blob()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 Oct 2015 13:37:54 +0000 (16:37 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Nov 2015 22:37:31 +0000 (14:37 -0800)
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 <dan.carpenter@oracle.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/drm_crtc.c

index 48a16a69ed24ccbd5823529716a4e587d7068bb7..4e8d72d40af40ea5b20dc3da20fd6badad8f1e9c 100644 (file)
@@ -4221,7 +4221,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);