summaryrefslogtreecommitdiff
path: root/net/atm/ioctl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-05-10 17:34:20 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2020-05-20 20:31:34 -0400
commita3929484af75ee524419edbbc4e9ce012c3d67c9 (patch)
tree3d9a07871d1f21d67790aff524f61b1085c14057 /net/atm/ioctl.c
parent8c2348e36af0da79477b0726781da297263269a4 (diff)
downloadlwn-a3929484af75ee524419edbbc4e9ce012c3d67c9.tar.gz
lwn-a3929484af75ee524419edbbc4e9ce012c3d67c9.zip
atm: move copyin from atm_getnames() into the caller
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/atm/ioctl.c')
-rw-r--r--net/atm/ioctl.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c
index 0b4b07740fe4..e239cebf48da 100644
--- a/net/atm/ioctl.c
+++ b/net/atm/ioctl.c
@@ -56,6 +56,8 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
int error;
struct list_head *pos;
void __user *argp = (void __user *)arg;
+ void __user *buf;
+ int __user *len;
vcc = ATM_SD(sock);
switch (cmd) {
@@ -163,7 +165,22 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
goto done;
if (cmd == ATM_GETNAMES) {
- error = atm_getnames(argp, compat);
+ if (IS_ENABLED(CONFIG_COMPAT) && compat) {
+#ifdef CONFIG_COMPAT
+ struct compat_atm_iobuf __user *ciobuf = argp;
+ compat_uptr_t cbuf;
+ len = &ciobuf->length;
+ if (get_user(cbuf, &ciobuf->buffer))
+ return -EFAULT;
+ buf = compat_ptr(cbuf);
+#endif
+ } else {
+ struct atm_iobuf __user *iobuf = argp;
+ len = &iobuf->length;
+ if (get_user(buf, &iobuf->buffer))
+ return -EFAULT;
+ }
+ error = atm_getnames(buf, len);
} else {
error = atm_dev_ioctl(cmd, argp, compat);
}