summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShreshtha SAHU <ssahu@nvidia.com>2016-12-01 00:08:01 +0530
committerWinnie Hsu <whsu@nvidia.com>2017-05-05 14:57:52 -0700
commit6a07aed9992e4e9f2008728209b83a38b5ae60c8 (patch)
treeb8902b1ec419374da45818f93be8cc630ab2d75f /drivers
parent988a3d056cd599a4f3e18d3b589303efd33fb13a (diff)
BACKPORT: drm: crtc: integer overflow in drm_property_create_blob()
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. This patch fixes a security vulnerability reported here: https://code.google.com/p/android/issues/detail?id=228947 Change-Id: I17ed8c6e30826074cfc6dd833deb423be9bd89c5 Fixes: f453ba046074 ('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> Bug 1846814 Signed-off-by: Shreshtha SAHU <ssahu@nvidia.com> Change-Id: I308e65797972a0a0650bd96bd130dfd2fbe9c993 Reviewed-on: http://git-master/r/1262503 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_crtc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 8759d699bd8e..d8fcc80ecee6 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2956,8 +2956,8 @@ static struct drm_property_blob *drm_property_create_blob(struct drm_device *dev
struct drm_property_blob *blob;
int ret;
- if (!length || !data)
- return NULL;
+ if (!length || !data || length > ULONG_MAX - sizeof(struct drm_property_blob))
+ return ERR_PTR(-EINVAL);
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
if (!blob)