Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

Al Viro cc04f6e2 0976d4e1

+12 -18
-11
fs/compat_ioctl.c
··· 534 534 #define HCIUARTSETFLAGS _IOW('U', 203, int) 535 535 #define HCIUARTGETFLAGS _IOR('U', 204, int) 536 536 537 - #define BNEPCONNADD _IOW('B', 200, int) 538 - #define BNEPCONNDEL _IOW('B', 201, int) 539 - #define BNEPGETCONNLIST _IOR('B', 210, int) 540 - #define BNEPGETCONNINFO _IOR('B', 211, int) 541 - #define BNEPGETSUPPFEAT _IOR('B', 212, int) 542 - 543 537 #define CMTPCONNADD _IOW('C', 200, int) 544 538 #define CMTPCONNDEL _IOW('C', 201, int) 545 539 #define CMTPGETCONNLIST _IOR('C', 210, int) ··· 1090 1096 COMPATIBLE_IOCTL(RFCOMMGETDEVLIST) 1091 1097 COMPATIBLE_IOCTL(RFCOMMGETDEVINFO) 1092 1098 COMPATIBLE_IOCTL(RFCOMMSTEALDLC) 1093 - COMPATIBLE_IOCTL(BNEPCONNADD) 1094 - COMPATIBLE_IOCTL(BNEPCONNDEL) 1095 - COMPATIBLE_IOCTL(BNEPGETCONNLIST) 1096 - COMPATIBLE_IOCTL(BNEPGETCONNINFO) 1097 - COMPATIBLE_IOCTL(BNEPGETSUPPFEAT) 1098 1099 COMPATIBLE_IOCTL(CMTPCONNADD) 1099 1100 COMPATIBLE_IOCTL(CMTPCONNDEL) 1100 1101 COMPATIBLE_IOCTL(CMTPGETCONNLIST)
+12 -7
net/bluetooth/bnep/sock.c
··· 49 49 return 0; 50 50 } 51 51 52 - static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 52 + static int do_bnep_sock_ioctl(struct socket *sock, unsigned int cmd, void __user *argp) 53 53 { 54 54 struct bnep_connlist_req cl; 55 55 struct bnep_connadd_req ca; 56 56 struct bnep_conndel_req cd; 57 57 struct bnep_conninfo ci; 58 58 struct socket *nsock; 59 - void __user *argp = (void __user *)arg; 60 59 __u32 supp_feat = BIT(BNEP_SETUP_RESPONSE); 61 60 int err; 62 61 63 - BT_DBG("cmd %x arg %lx", cmd, arg); 62 + BT_DBG("cmd %x arg %p", cmd, argp); 64 63 65 64 switch (cmd) { 66 65 case BNEPCONNADD: ··· 133 134 return 0; 134 135 } 135 136 137 + static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 138 + { 139 + return do_bnep_sock_ioctl(sock, cmd, (void __user *)arg); 140 + } 141 + 136 142 #ifdef CONFIG_COMPAT 137 143 static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) 138 144 { 145 + void __user *argp = compat_ptr(arg); 139 146 if (cmd == BNEPGETCONNLIST) { 140 147 struct bnep_connlist_req cl; 148 + unsigned __user *p = argp; 141 149 u32 uci; 142 150 int err; 143 151 144 - if (get_user(cl.cnum, (u32 __user *) arg) || 145 - get_user(uci, (u32 __user *) (arg + 4))) 152 + if (get_user(cl.cnum, p) || get_user(uci, p + 1)) 146 153 return -EFAULT; 147 154 148 155 cl.ci = compat_ptr(uci); ··· 158 153 159 154 err = bnep_get_connlist(&cl); 160 155 161 - if (!err && put_user(cl.cnum, (u32 __user *) arg)) 156 + if (!err && put_user(cl.cnum, p)) 162 157 err = -EFAULT; 163 158 164 159 return err; 165 160 } 166 161 167 - return bnep_sock_ioctl(sock, cmd, arg); 162 + return do_bnep_sock_ioctl(sock, cmd, argp); 168 163 } 169 164 #endif 170 165