Skip to content

Commit f37d63e

Browse files
Philipp Stannerairlied
authored andcommitted
drm_lease.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@redhat.com> Signed-off-by: Philipp Stanner <pstanner@redhat.com> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Zack Rusin <zackr@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-6-pstanner@redhat.com
1 parent ca07765 commit f37d63e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/drm_lease.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
510510
/* Handle leased objects, if any */
511511
idr_init(&leases);
512512
if (object_count != 0) {
513-
object_ids = memdup_user(u64_to_user_ptr(cl->object_ids),
514-
array_size(object_count, sizeof(__u32)));
513+
object_ids = memdup_array_user(u64_to_user_ptr(cl->object_ids),
514+
object_count, sizeof(__u32));
515515
if (IS_ERR(object_ids)) {
516516
ret = PTR_ERR(object_ids);
517517
idr_destroy(&leases);

0 commit comments

Comments
 (0)