From: David S. Miller Date: Tue, 15 Dec 2015 20:39:08 +0000 (-0500) Subject: bluetooth: Validate socket address length in sco_sock_bind(). X-Git-Tag: v3.2.75~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=805ce945362d9e496563c9885e7fde00cbd83635;p=thirdparty%2Fkernel%2Fstable.git bluetooth: Validate socket address length in sco_sock_bind(). [ Upstream commit 5233252fce714053f0151680933571a2da9cbfb4 ] Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings --- diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 2e80aee730b2c..9f0e5a4e25831 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -475,6 +475,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) {