[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200228092321.axulddmkxrujkmas@kili.mountain>
Date: Fri, 28 Feb 2020 12:23:21 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
Cc: Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH] drm: prevent a harmless integer overflow in
drm_legacy_sg_alloc()
There is an integer overflow when we round up to PAGE_SIZE, but it's
harmless because we never re-use "request->size" for anything meaningful.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
This code predates git.
drivers/gpu/drm/drm_scatter.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
index d5c386154246..ca520028b2cb 100644
--- a/drivers/gpu/drm/drm_scatter.c
+++ b/drivers/gpu/drm/drm_scatter.c
@@ -99,6 +99,9 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
if (!drm_core_check_feature(dev, DRIVER_SG))
return -EOPNOTSUPP;
+ if (request->size > SIZE_MAX - PAGE_SIZE)
+ return -EINVAL;
+
if (dev->sg)
return -EINVAL;
--
2.11.0
Powered by blists - more mailing lists