1 From 0a280962dc6e117e0e4baa668453f753579265d9 Mon Sep 17 00:00:00 2001
2 From: Al Viro <viro@zeniv.linux.org.uk>
3 Date: Sat, 21 Feb 2015 22:19:57 -0500
4 Subject: autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
6 From: Al Viro <viro@zeniv.linux.org.uk>
8 commit 0a280962dc6e117e0e4baa668453f753579265d9 upstream.
10 X-Coverup: just ask spender
11 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 fs/autofs4/dev-ioctl.c | 8 ++++++--
16 1 file changed, 6 insertions(+), 2 deletions(-)
18 --- a/fs/autofs4/dev-ioctl.c
19 +++ b/fs/autofs4/dev-ioctl.c
20 @@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int c
22 static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
24 - struct autofs_dev_ioctl tmp;
25 + struct autofs_dev_ioctl tmp, *res;
27 if (copy_from_user(&tmp, in, sizeof(tmp)))
28 return ERR_PTR(-EFAULT);
29 @@ -106,7 +106,11 @@ static struct autofs_dev_ioctl *copy_dev
30 if (tmp.size > (PATH_MAX + sizeof(tmp)))
31 return ERR_PTR(-ENAMETOOLONG);
33 - return memdup_user(in, tmp.size);
34 + res = memdup_user(in, tmp.size);
36 + res->size = tmp.size;
41 static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)