forked from Minki/linux
atm: lift copyin from atm_dev_ioctl()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
36085049bc
commit
8cacb41659
@ -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:
|
||||
|
@ -227,39 +227,14 @@ int atm_getnames(void __user *buf, int __user *iobuf_len)
|
||||
return error;
|
||||
}
|
||||
|
||||
int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
|
||||
int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
|
||||
int number, int compat)
|
||||
{
|
||||
void __user *buf;
|
||||
int error, len, number, size = 0;
|
||||
int error, len, size = 0;
|
||||
struct atm_dev *dev;
|
||||
int __user *sioc_len;
|
||||
|
||||
if (IS_ENABLED(CONFIG_COMPAT) && compat) {
|
||||
#ifdef CONFIG_COMPAT
|
||||
struct compat_atmif_sioc __user *csioc = arg;
|
||||
compat_uptr_t carg;
|
||||
|
||||
sioc_len = &csioc->length;
|
||||
if (get_user(carg, &csioc->arg))
|
||||
return -EFAULT;
|
||||
buf = compat_ptr(carg);
|
||||
|
||||
if (get_user(len, &csioc->length))
|
||||
return -EFAULT;
|
||||
if (get_user(number, &csioc->number))
|
||||
return -EFAULT;
|
||||
#endif
|
||||
} else {
|
||||
struct atmif_sioc __user *sioc = arg;
|
||||
|
||||
sioc_len = &sioc->length;
|
||||
if (get_user(buf, &sioc->arg))
|
||||
return -EFAULT;
|
||||
if (get_user(len, &sioc->length))
|
||||
return -EFAULT;
|
||||
if (get_user(number, &sioc->number))
|
||||
return -EFAULT;
|
||||
}
|
||||
if (get_user(len, sioc_len))
|
||||
return -EFAULT;
|
||||
|
||||
dev = try_then_request_module(atm_dev_lookup(number), "atm-device-%d",
|
||||
number);
|
||||
|
@ -15,8 +15,8 @@ extern struct list_head atm_devs;
|
||||
extern struct mutex atm_dev_mutex;
|
||||
|
||||
int atm_getnames(void __user *buf, int __user *iobuf_len);
|
||||
int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat);
|
||||
|
||||
int atm_dev_ioctl(unsigned int cmd, void __user *buf, int __user *sioc_len,
|
||||
int number, int compat);
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user