forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/net/bluetooth/bnep/sock.c
....@@ -49,18 +49,17 @@
4949 return 0;
5050 }
5151
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)
5353 {
5454 struct bnep_connlist_req cl;
5555 struct bnep_connadd_req ca;
5656 struct bnep_conndel_req cd;
5757 struct bnep_conninfo ci;
5858 struct socket *nsock;
59
- void __user *argp = (void __user *)arg;
6059 __u32 supp_feat = BIT(BNEP_SETUP_RESPONSE);
6160 int err;
6261
63
- BT_DBG("cmd %x arg %lx", cmd, arg);
62
+ BT_DBG("cmd %x arg %p", cmd, argp);
6463
6564 switch (cmd) {
6665 case BNEPCONNADD:
....@@ -134,16 +133,22 @@
134133 return 0;
135134 }
136135
136
+static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
137
+{
138
+ return do_bnep_sock_ioctl(sock, cmd, (void __user *)arg);
139
+}
140
+
137141 #ifdef CONFIG_COMPAT
138142 static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
139143 {
144
+ void __user *argp = compat_ptr(arg);
140145 if (cmd == BNEPGETCONNLIST) {
141146 struct bnep_connlist_req cl;
147
+ unsigned __user *p = argp;
142148 u32 uci;
143149 int err;
144150
145
- if (get_user(cl.cnum, (u32 __user *) arg) ||
146
- get_user(uci, (u32 __user *) (arg + 4)))
151
+ if (get_user(cl.cnum, p) || get_user(uci, p + 1))
147152 return -EFAULT;
148153
149154 cl.ci = compat_ptr(uci);
....@@ -153,13 +158,13 @@
153158
154159 err = bnep_get_connlist(&cl);
155160
156
- if (!err && put_user(cl.cnum, (u32 __user *) arg))
161
+ if (!err && put_user(cl.cnum, p))
157162 err = -EFAULT;
158163
159164 return err;
160165 }
161166
162
- return bnep_sock_ioctl(sock, cmd, arg);
167
+ return do_bnep_sock_ioctl(sock, cmd, argp);
163168 }
164169 #endif
165170
....@@ -177,8 +182,6 @@
177182 .recvmsg = sock_no_recvmsg,
178183 .listen = sock_no_listen,
179184 .shutdown = sock_no_shutdown,
180
- .setsockopt = sock_no_setsockopt,
181
- .getsockopt = sock_no_getsockopt,
182185 .connect = sock_no_connect,
183186 .socketpair = sock_no_socketpair,
184187 .accept = sock_no_accept,