Message ID | 20210322140046.1.I6c4306f6e8ba3ccc9106067d4eb70092f8cb2a49@changeid |
---|---|
State | New |
Headers | show |
Series | Bluetooth: check for zapped sk before connecting | expand |
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index f1b1edd0b697..b86fd8cc4dc1 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -182,6 +182,13 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, BT_DBG("sk %p", sk); + lock_sock(sk); + if (sock_flag(sk, SOCK_ZAPPED)) { + release_sock(sk); + return -EINVAL; + } + release_sock(sk); + if (!addr || alen < offsetofend(struct sockaddr, sa_family) || addr->sa_family != AF_BLUETOOTH) return -EINVAL;