Skip to content

Commit 0a28096

Browse files
author
Al Viro
committed
autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
X-Coverup: just ask spender Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 7e0e953 commit 0a28096

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/autofs4/dev-ioctl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)
9595
*/
9696
static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
9797
{
98-
struct autofs_dev_ioctl tmp;
98+
struct autofs_dev_ioctl tmp, *res;
9999

100100
if (copy_from_user(&tmp, in, sizeof(tmp)))
101101
return ERR_PTR(-EFAULT);
@@ -106,7 +106,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
106106
if (tmp.size > (PATH_MAX + sizeof(tmp)))
107107
return ERR_PTR(-ENAMETOOLONG);
108108

109-
return memdup_user(in, tmp.size);
109+
res = memdup_user(in, tmp.size);
110+
if (!IS_ERR(res))
111+
res->size = tmp.size;
112+
113+
return res;
110114
}
111115

112116
static inline void free_dev_ioctl(struct autofs_dev_ioctl *param)

0 commit comments

Comments
 (0)