bluetooth: Validate socket address length in sco_sock_bind().
authorDavid S. Miller <davem@davemloft.net>
Tue, 15 Dec 2015 20:39:08 +0000 (15:39 -0500)
committerSasha Levin <sasha.levin@oracle.com>
Fri, 15 Jan 2016 23:41:51 +0000 (18:41 -0500)
[ Upstream commit 5233252fce714053f0151680933571a2da9cbfb4 ]

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
net/bluetooth/sco.c

index 7ee9e4ab00f882f827f7b63361dc82a24ca72a23..b3ef78a644eda5e556f6c2ece90feff8922da180 100644 (file)
@@ -520,6 +520,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
        if (!addr || addr->sa_family != AF_BLUETOOTH)
                return -EINVAL;
 
+       if (addr_len < sizeof(struct sockaddr_sco))
+               return -EINVAL;
+
        lock_sock(sk);
 
        if (sk->sk_state != BT_OPEN) {