Commit 060ea427 authored by Vincent Stehlé's avatar Vincent Stehlé Committed by Greg Kroah-Hartman

staging: android: vsoc: fix copy_from_user overrun

The `np->permission' structure is smaller than the `np' structure but
sizeof(*np) worth of data is copied in there. Fix the size passed to
copy_from_user() to avoid overrun.

Fixes: 3d2ec9dc ("staging: Android: Add 'vsoc' driver for cuttlefish.")
Signed-off-by: default avatarVincent Stehlé <vincent.stehle@laposte.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent deaf3b71
...@@ -259,7 +259,8 @@ do_create_fd_scoped_permission(struct vsoc_device_region *region_p, ...@@ -259,7 +259,8 @@ do_create_fd_scoped_permission(struct vsoc_device_region *region_p,
atomic_t *owner_ptr = NULL; atomic_t *owner_ptr = NULL;
struct vsoc_device_region *managed_region_p; struct vsoc_device_region *managed_region_p;
if (copy_from_user(&np->permission, &arg->perm, sizeof(*np)) || if (copy_from_user(&np->permission,
&arg->perm, sizeof(np->permission)) ||
copy_from_user(&managed_fd, copy_from_user(&managed_fd,
&arg->managed_region_fd, sizeof(managed_fd))) { &arg->managed_region_fd, sizeof(managed_fd))) {
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment