[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d2b36a2cf7bbff1b036f474eb805e19be3c57f5.1694202430.git.pstanner@redhat.com>
Date: Fri, 8 Sep 2023 21:59:44 +0200
From: Philipp Stanner <pstanner@...hat.com>
To: Kees Cook <keescook@...omium.org>,
Andy Shevchenko <andy@...nel.org>,
Eric Biederman <ebiederm@...ssion.com>,
Christian Brauner <brauner@...nel.org>,
David Disseldorp <ddiss@...e.de>,
Luis Chamberlain <mcgrof@...nel.org>,
Siddh Raman Pant <code@...dh.me>,
Nick Alcock <nick.alcock@...cle.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Zack Rusin <zackr@...are.com>
Cc: VMware Graphics Reviewers <linux-graphics-maintainer@...are.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org, linux-hardening@...r.kernel.org,
Philipp Stanner <pstanner@...hat.com>,
David Airlie <airlied@...hat.com>
Subject: [PATCH v2 5/5] drm: vmgfx_surface.c: copy user-array safely
Currently, there is no overflow-check with memdup_user().
Use the new function memdup_array_user() instead of memdup_user() for
duplicating the user-space array safely.
Suggested-by: David Airlie <airlied@...hat.com>
Signed-off-by: Philipp Stanner <pstanner@...hat.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 5db403ee8261..9be185b094cb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -777,9 +777,9 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
sizeof(metadata->mip_levels));
metadata->num_sizes = num_sizes;
metadata->sizes =
- memdup_user((struct drm_vmw_size __user *)(unsigned long)
+ memdup_array_user((struct drm_vmw_size __user *)(unsigned long)
req->size_addr,
- sizeof(*metadata->sizes) * metadata->num_sizes);
+ metadata->num_sizes, sizeof(*metadata->sizes));
if (IS_ERR(metadata->sizes)) {
ret = PTR_ERR(metadata->sizes);
goto out_no_sizes;
--
2.41.0
Powered by blists - more mailing lists