Bluetooth: L2CAP - Fix info leak via getsockname()
authorMathias Krause <[email protected]>
Wed, 15 Aug 2012 11:31:51 +0000 (11:31 +0000)
committerDavid S. Miller <[email protected]>
Thu, 16 Aug 2012 04:36:31 +0000 (21:36 -0700)
The L2CAP code fails to initialize the l2_bdaddr_type member of struct
sockaddr_l2 and the padding byte added for alignment. It that for leaks
two bytes kernel stack via the getsockname() syscall. Add an explicit
memset(0) before filling the structure to avoid the info leak.

Signed-off-by: Mathias Krause <[email protected]>
Cc: Marcel Holtmann <[email protected]>
Cc: Gustavo Padovan <[email protected]>
Cc: Johan Hedberg <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/bluetooth/l2cap_sock.c

index b94abd30e6f948a4ebe0a72fef5a157eb24d40fb..1497edd191a2e04ee3121624db92547059f24369 100644 (file)
@@ -245,6 +245,7 @@ static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *l
 
        BT_DBG("sock %p, sk %p", sock, sk);
 
+       memset(la, 0, sizeof(struct sockaddr_l2));
        addr->sa_family = AF_BLUETOOTH;
        *len = sizeof(struct sockaddr_l2);