diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 68f486a586ff..95498d553b00 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -72,6 +72,15 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) | |||
72 | if (!bdaddr_type_is_valid(la.l2_bdaddr_type)) | 72 | if (!bdaddr_type_is_valid(la.l2_bdaddr_type)) |
73 | return -EINVAL; | 73 | return -EINVAL; |
74 | 74 | ||
75 | if (bdaddr_type_is_le(la.l2_bdaddr_type)) { | ||
76 | /* Connection oriented channels are not supported on LE */ | ||
77 | if (la.l2_psm) | ||
78 | return -EINVAL; | ||
79 | /* We only allow ATT user space socket */ | ||
80 | if (la.l2_cid != L2CAP_CID_ATT) | ||
81 | return -EINVAL; | ||
82 | } | ||
83 | |||
75 | lock_sock(sk); | 84 | lock_sock(sk); |
76 | 85 | ||
77 | if (sk->sk_state != BT_OPEN) { | 86 | if (sk->sk_state != BT_OPEN) { |
@@ -156,6 +165,15 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, | |||
156 | if (chan->src_type != BDADDR_BREDR && la.l2_bdaddr_type == BDADDR_BREDR) | 165 | if (chan->src_type != BDADDR_BREDR && la.l2_bdaddr_type == BDADDR_BREDR) |
157 | return -EINVAL; | 166 | return -EINVAL; |
158 | 167 | ||
168 | if (bdaddr_type_is_le(la.l2_bdaddr_type)) { | ||
169 | /* Connection oriented channels are not supported on LE */ | ||
170 | if (la.l2_psm) | ||
171 | return -EINVAL; | ||
172 | /* We only allow ATT user space socket */ | ||
173 | if (la.l2_cid != L2CAP_CID_ATT) | ||
174 | return -EINVAL; | ||
175 | } | ||
176 | |||
159 | err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid), | 177 | err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid), |
160 | &la.l2_bdaddr, la.l2_bdaddr_type); | 178 | &la.l2_bdaddr, la.l2_bdaddr_type); |
161 | if (err) | 179 | if (err) |