diff options
author | Vincent Stehlé <vincent.stehle@laposte.net> | 2019-04-14 17:37:26 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-16 13:31:58 +0200 |
commit | 060ea4271a82270be6d44e8e9aefe8f155fb5626 (patch) | |
tree | 6059c57e955a8600f007c2f785a2732cb9c8af25 | |
parent | deaf3b71550de08c88f9b40b118dbb87b3668af0 (diff) | |
download | linux-stable-060ea4271a82270be6d44e8e9aefe8f155fb5626.tar.gz linux-stable-060ea4271a82270be6d44e8e9aefe8f155fb5626.tar.bz2 linux-stable-060ea4271a82270be6d44e8e9aefe8f155fb5626.zip |
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: 3d2ec9dcd553 ("staging: Android: Add 'vsoc' driver for cuttlefish.")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/android/vsoc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/android/vsoc.c b/drivers/staging/android/vsoc.c index 8a75bd27c413..00a1ec7b9154 100644 --- a/drivers/staging/android/vsoc.c +++ b/drivers/staging/android/vsoc.c @@ -259,7 +259,8 @@ do_create_fd_scoped_permission(struct vsoc_device_region *region_p, atomic_t *owner_ptr = NULL; 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, &arg->managed_region_fd, sizeof(managed_fd))) { return -EFAULT; |