summaryrefslogtreecommitdiffstats
path: root/net/atm/ioctl.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2020-05-10 17:53:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2020-05-20 20:31:35 -0400
commit8cacb4165985444c275a6f813f91f08479bdbfad (patch)
tree00cd065ec52d8e90081edbef1fa7380557eea0e3 /net/atm/ioctl.c
parent36085049bc0acb6f2e784f430c2cc66944a2ef07 (diff)
downloadlinux-stable-8cacb4165985444c275a6f813f91f08479bdbfad.tar.gz
linux-stable-8cacb4165985444c275a6f813f91f08479bdbfad.tar.bz2
linux-stable-8cacb4165985444c275a6f813f91f08479bdbfad.zip
atm: lift copyin from atm_dev_ioctl()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/atm/ioctl.c')
-rw-r--r--net/atm/ioctl.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/net/atm/ioctl.c b/net/atm/ioctl.c
index fdd0e3434523..52f2c77e656f 100644
--- a/net/atm/ioctl.c
+++ b/net/atm/ioctl.c
@@ -182,7 +182,30 @@ static int do_vcc_ioctl(struct socket *sock, unsigned int cmd,
}
error = atm_getnames(buf, len);
} else {
- error = atm_dev_ioctl(cmd, argp, compat);
+ int number;
+
+ if (IS_ENABLED(CONFIG_COMPAT) && compat) {
+#ifdef CONFIG_COMPAT
+ struct compat_atmif_sioc __user *csioc = argp;
+ compat_uptr_t carg;
+
+ len = &csioc->length;
+ if (get_user(carg, &csioc->arg))
+ return -EFAULT;
+ buf = compat_ptr(carg);
+ if (get_user(number, &csioc->number))
+ return -EFAULT;
+#endif
+ } else {
+ struct atmif_sioc __user *sioc = argp;
+
+ len = &sioc->length;
+ if (get_user(buf, &sioc->arg))
+ return -EFAULT;
+ if (get_user(number, &sioc->number))
+ return -EFAULT;
+ }
+ error = atm_dev_ioctl(cmd, buf, len, number, compat);
}
done: