aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/l2cap.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r--net/bluetooth/l2cap.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index b93748e224ff..df1a95e185c6 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -1106,7 +1106,7 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms
1106 return err; 1106 return err;
1107} 1107}
1108 1108
1109static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 1109static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, int optlen)
1110{ 1110{
1111 struct sock *sk = sock->sk; 1111 struct sock *sk = sock->sk;
1112 struct l2cap_options opts; 1112 struct l2cap_options opts;
@@ -1152,7 +1152,29 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
1152 return err; 1152 return err;
1153} 1153}
1154 1154
1155static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) 1155static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
1156{
1157 struct sock *sk = sock->sk;
1158 int err = 0;
1159
1160 BT_DBG("sk %p", sk);
1161
1162 if (level == SOL_L2CAP)
1163 return l2cap_sock_setsockopt_old(sock, optname, optval, optlen);
1164
1165 lock_sock(sk);
1166
1167 switch (optname) {
1168 default:
1169 err = -ENOPROTOOPT;
1170 break;
1171 }
1172
1173 release_sock(sk);
1174 return err;
1175}
1176
1177static int l2cap_sock_getsockopt_old(struct socket *sock, int optname, char __user *optval, int __user *optlen)
1156{ 1178{
1157 struct sock *sk = sock->sk; 1179 struct sock *sk = sock->sk;
1158 struct l2cap_options opts; 1180 struct l2cap_options opts;
@@ -1208,6 +1230,31 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
1208 return err; 1230 return err;
1209} 1231}
1210 1232
1233static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen)
1234{
1235 struct sock *sk = sock->sk;
1236 int len, err = 0;
1237
1238 BT_DBG("sk %p", sk);
1239
1240 if (level == SOL_L2CAP)
1241 return l2cap_sock_getsockopt_old(sock, optname, optval, optlen);
1242
1243 if (get_user(len, optlen))
1244 return -EFAULT;
1245
1246 lock_sock(sk);
1247
1248 switch (optname) {
1249 default:
1250 err = -ENOPROTOOPT;
1251 break;
1252 }
1253
1254 release_sock(sk);
1255 return err;
1256}
1257
1211static int l2cap_sock_shutdown(struct socket *sock, int how) 1258static int l2cap_sock_shutdown(struct socket *sock, int how)
1212{ 1259{
1213 struct sock *sk = sock->sk; 1260 struct sock *sk = sock->sk;