[Lucid,CVE-2012-6545,1/2] Bluetooth: RFCOMM - Fix info leak via getsockname()

Message ID 1364318222-16926-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques March 26, 2013, 5:17 p.m.
From: Mathias Krause <minipli@googlemail.com>


BugLink: http://bugs.launchpad.net/bugs/1156757

The RFCOMM code fails to initialize the trailing padding byte of struct
sockaddr_rc added for alignment. It that for leaks one byte 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 <minipli@googlemail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9344a972961d1a6d2c04d9008b13617bcb6ec2ef)

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
 net/bluetooth/rfcomm/sock.c | 1 +
 1 file changed, 1 insertion(+)


Tim Gardner March 26, 2013, 5:37 p.m. | #1


diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 1ae3f80..c47b7c4 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -543,6 +543,7 @@  static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int *
 	BT_DBG("sock %p, sk %p", sock, sk);
+	memset(sa, 0, sizeof(*sa));
 	sa->rc_family  = AF_BLUETOOTH;
 	sa->rc_channel = rfcomm_pi(sk)->channel;
 	if (peer)