bnep: fix compat_ioctl
use compat_ptr() properly and don't bother with fs/compat_ioctl.c - it's all handled in ->compat_ioctl() anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
0976d4e1dc
commit
cc04f6e242
|
@ -534,12 +534,6 @@ static int mt_ioctl_trans(struct file *file,
|
||||||
#define HCIUARTSETFLAGS _IOW('U', 203, int)
|
#define HCIUARTSETFLAGS _IOW('U', 203, int)
|
||||||
#define HCIUARTGETFLAGS _IOR('U', 204, int)
|
#define HCIUARTGETFLAGS _IOR('U', 204, int)
|
||||||
|
|
||||||
#define BNEPCONNADD _IOW('B', 200, int)
|
|
||||||
#define BNEPCONNDEL _IOW('B', 201, int)
|
|
||||||
#define BNEPGETCONNLIST _IOR('B', 210, int)
|
|
||||||
#define BNEPGETCONNINFO _IOR('B', 211, int)
|
|
||||||
#define BNEPGETSUPPFEAT _IOR('B', 212, int)
|
|
||||||
|
|
||||||
#define CMTPCONNADD _IOW('C', 200, int)
|
#define CMTPCONNADD _IOW('C', 200, int)
|
||||||
#define CMTPCONNDEL _IOW('C', 201, int)
|
#define CMTPCONNDEL _IOW('C', 201, int)
|
||||||
#define CMTPGETCONNLIST _IOR('C', 210, int)
|
#define CMTPGETCONNLIST _IOR('C', 210, int)
|
||||||
|
@ -1096,11 +1090,6 @@ COMPATIBLE_IOCTL(RFCOMMRELEASEDEV)
|
||||||
COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
|
COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
|
||||||
COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
|
COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
|
||||||
COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
|
COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
|
||||||
COMPATIBLE_IOCTL(BNEPCONNADD)
|
|
||||||
COMPATIBLE_IOCTL(BNEPCONNDEL)
|
|
||||||
COMPATIBLE_IOCTL(BNEPGETCONNLIST)
|
|
||||||
COMPATIBLE_IOCTL(BNEPGETCONNINFO)
|
|
||||||
COMPATIBLE_IOCTL(BNEPGETSUPPFEAT)
|
|
||||||
COMPATIBLE_IOCTL(CMTPCONNADD)
|
COMPATIBLE_IOCTL(CMTPCONNADD)
|
||||||
COMPATIBLE_IOCTL(CMTPCONNDEL)
|
COMPATIBLE_IOCTL(CMTPCONNDEL)
|
||||||
COMPATIBLE_IOCTL(CMTPGETCONNLIST)
|
COMPATIBLE_IOCTL(CMTPGETCONNLIST)
|
||||||
|
|
|
@ -49,18 +49,17 @@ static int bnep_sock_release(struct socket *sock)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
static int do_bnep_sock_ioctl(struct socket *sock, unsigned int cmd, void __user *argp)
|
||||||
{
|
{
|
||||||
struct bnep_connlist_req cl;
|
struct bnep_connlist_req cl;
|
||||||
struct bnep_connadd_req ca;
|
struct bnep_connadd_req ca;
|
||||||
struct bnep_conndel_req cd;
|
struct bnep_conndel_req cd;
|
||||||
struct bnep_conninfo ci;
|
struct bnep_conninfo ci;
|
||||||
struct socket *nsock;
|
struct socket *nsock;
|
||||||
void __user *argp = (void __user *)arg;
|
|
||||||
__u32 supp_feat = BIT(BNEP_SETUP_RESPONSE);
|
__u32 supp_feat = BIT(BNEP_SETUP_RESPONSE);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
BT_DBG("cmd %x arg %lx", cmd, arg);
|
BT_DBG("cmd %x arg %p", cmd, argp);
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case BNEPCONNADD:
|
case BNEPCONNADD:
|
||||||
|
@ -134,16 +133,22 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||||
|
{
|
||||||
|
return do_bnep_sock_ioctl(sock, cmd, (void __user *)arg);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
void __user *argp = compat_ptr(arg);
|
||||||
if (cmd == BNEPGETCONNLIST) {
|
if (cmd == BNEPGETCONNLIST) {
|
||||||
struct bnep_connlist_req cl;
|
struct bnep_connlist_req cl;
|
||||||
|
unsigned __user *p = argp;
|
||||||
u32 uci;
|
u32 uci;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (get_user(cl.cnum, (u32 __user *) arg) ||
|
if (get_user(cl.cnum, p) || get_user(uci, p + 1))
|
||||||
get_user(uci, (u32 __user *) (arg + 4)))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
cl.ci = compat_ptr(uci);
|
cl.ci = compat_ptr(uci);
|
||||||
|
@ -153,13 +158,13 @@ static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigne
|
||||||
|
|
||||||
err = bnep_get_connlist(&cl);
|
err = bnep_get_connlist(&cl);
|
||||||
|
|
||||||
if (!err && put_user(cl.cnum, (u32 __user *) arg))
|
if (!err && put_user(cl.cnum, p))
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bnep_sock_ioctl(sock, cmd, arg);
|
return do_bnep_sock_ioctl(sock, cmd, argp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue