[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1365335522-29931-11-git-send-email-minipli@googlemail.com>
Date: Sun, 7 Apr 2013 13:51:56 +0200
From: Mathias Krause <minipli@...glemail.com>
To: "David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org,
Allan Stephens <allan.stephens@...driver.com>,
Aloisio Almeida Jr <aloisio.almeida@...nbossa.org>,
Andy King <acking@...are.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Dmitry Torokhov <dtor@...are.com>,
George Zhang <georgezhang@...are.com>,
Gustavo Padovan <gustavo@...ovan.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Jon Maloy <jon.maloy@...csson.com>,
Lauro Ramos Venancio <lauro.venancio@...nbossa.org>,
Marcel Holtmann <marcel@...tmann.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Samuel Ortiz <samuel@...tiz.org>,
Sjur Braendeland <sjur.brandeland@...ricsson.com>,
Ursula Braun <ursula.braun@...ibm.com>,
Brad Spengler <spender@...ecurity.net>,
Mathias Krause <minipli@...glemail.com>
Subject: [PATCH 10/16] llc: Fix missing msg_namelen update in llc_ui_recvmsg()
For stream sockets the code misses to update the msg_namelen member
to 0 and therefore makes net/socket.c leak the local, uninitialized
sockaddr_storage variable to userland -- 128 bytes of kernel stack
memory. The msg_namelen update is also missing for datagram sockets
in case the socket is shutting down during receive.
Fix both issues by setting msg_namelen to 0 early. It will be
updated later if we're going to fill the msg_name member.
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Signed-off-by: Mathias Krause <minipli@...glemail.com>
---
net/llc/af_llc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 8870988..48aaa89 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -720,6 +720,8 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
int target; /* Read at least this many bytes */
long timeo;
+ msg->msg_namelen = 0;
+
lock_sock(sk);
copied = -ENOTCONN;
if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists