Explorar o código

Bluetooth: bnep: bnep_add_connection() should verify that it's dealing with l2cap socket

same story as cmtp

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Al Viro %!s(int64=10) %!d(string=hai) anos
pai
achega
71bb99a02b
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      net/bluetooth/bnep/core.c

+ 3 - 0
net/bluetooth/bnep/core.c

@@ -533,6 +533,9 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
 
 	BT_DBG("");
 
+	if (!l2cap_is_socket(sock))
+		return -EBADFD;
+
 	baswap((void *) dst, &l2cap_pi(sock->sk)->chan->dst);
 	baswap((void *) src, &l2cap_pi(sock->sk)->chan->src);