This is a note to let you know that I've just added the patch titled tipc: fix info leaks via msg_name in recv_msg/recv_stream to the 3.8-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tipc-fix-info-leaks-via-msg_name-in-recv_msg-recv_stream.patch and it can be found in the queue-3.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From d58e6639a0cf7fce85ad69a0906938f3754ccede Mon Sep 17 00:00:00 2001 From: Mathias Krause <minipli@xxxxxxxxxxxxxx> Date: Sun, 7 Apr 2013 01:52:00 +0000 Subject: tipc: fix info leaks via msg_name in recv_msg/recv_stream From: Mathias Krause <minipli@xxxxxxxxxxxxxx> [ Upstream commit 60085c3d009b0df252547adb336d1ccca5ce52ec ] The code in set_orig_addr() does not initialize all of the members of struct sockaddr_tipc when filling the sockaddr info -- namely the union is only partly filled. This will make recv_msg() and recv_stream() -- the only users of this function -- leak kernel stack memory as the msg_name member is a local variable in net/socket.c. Additionally to that both recv_msg() and recv_stream() fail to update the msg_namelen member to 0 while otherwise returning with 0, i.e. "success". This is the case for, e.g., non-blocking sockets. This will lead to a 128 byte kernel stack leak in net/socket.c. Fix the first issue by initializing the memory of the union with memset(0). Fix the second one by setting msg_namelen to 0 early as it will be updated later if we're going to fill the msg_name member. Signed-off-by: Mathias Krause <minipli@xxxxxxxxxxxxxx> Cc: Jon Maloy <jon.maloy@xxxxxxxxxxxx> Cc: Allan Stephens <allan.stephens@xxxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/tipc/socket.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -806,6 +806,7 @@ static void set_orig_addr(struct msghdr if (addr) { addr->family = AF_TIPC; addr->addrtype = TIPC_ADDR_ID; + memset(&addr->addr, 0, sizeof(addr->addr)); addr->addr.id.ref = msg_origport(msg); addr->addr.id.node = msg_orignode(msg); addr->addr.name.domain = 0; /* could leave uninitialized */ @@ -920,6 +921,9 @@ static int recv_msg(struct kiocb *iocb, goto exit; } + /* will be updated in set_orig_addr() if needed */ + m->msg_namelen = 0; + timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); restart: @@ -1029,6 +1033,9 @@ static int recv_stream(struct kiocb *ioc goto exit; } + /* will be updated in set_orig_addr() if needed */ + m->msg_namelen = 0; + target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len); timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); Patches currently in stable-queue which might be from minipli@xxxxxxxxxxxxxx are queue-3.8/irda-fix-missing-msg_namelen-update-in-irda_recvmsg_dgram.patch queue-3.8/bluetooth-rfcomm-fix-missing-msg_namelen-update-in-rfcomm_sock_recvmsg.patch queue-3.8/llc-fix-missing-msg_namelen-update-in-llc_ui_recvmsg.patch queue-3.8/nfc-llcp-fix-info-leaks-via-msg_name-in-llcp_sock_recvmsg.patch queue-3.8/atm-update-msg_namelen-in-vcc_recvmsg.patch queue-3.8/iucv-fix-missing-msg_namelen-update-in-iucv_sock_recvmsg.patch queue-3.8/ax25-fix-info-leak-via-msg_name-in-ax25_recvmsg.patch queue-3.8/tipc-fix-info-leaks-via-msg_name-in-recv_msg-recv_stream.patch queue-3.8/netrom-fix-info-leak-via-msg_name-in-nr_recvmsg.patch queue-3.8/caif-fix-missing-msg_namelen-update-in-caif_seqpkt_recvmsg.patch queue-3.8/l2tp-fix-info-leak-in-l2tp_ip6_recvmsg.patch queue-3.8/bluetooth-sco-fix-missing-msg_namelen-update-in-sco_sock_recvmsg.patch queue-3.8/bluetooth-fix-possible-info-leak-in-bt_sock_recvmsg.patch queue-3.8/rose-fix-info-leak-via-msg_name-in-rose_recvmsg.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html