From patchwork Thu May 9 10:01:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 242741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id A0A662C00EB for ; Thu, 9 May 2013 20:01:51 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UaNfW-00006N-1Q; Thu, 09 May 2013 10:01:46 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1UaNfR-000059-Ct for kernel-team@lists.ubuntu.com; Thu, 09 May 2013 10:01:41 +0000 Received: from bl16-212-84.dsl.telepac.pt ([188.81.212.84] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1UaNfR-0001eC-7q for kernel-team@lists.ubuntu.com; Thu, 09 May 2013 10:01:41 +0000 From: Luis Henriques To: kernel-team@lists.ubuntu.com Subject: [Lucid Precise CVE-2013-3222] atm: update msg_namelen in vcc_recvmsg() Date: Thu, 9 May 2013 11:01:39 +0100 Message-Id: <1368093700-6678-1-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.8.1.2 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Mathias Krause CVE-2013-3222 BugLink: https://bugs.launchpad.net/bugs/1172365 The current code does not fill the msg_name member in case it is set. It also does not set 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. Fix that by simply setting msg_namelen to 0 as obviously nobody cared about vcc_recvmsg() not filling the msg_name in case it was set. Signed-off-by: Mathias Krause Signed-off-by: David S. Miller (cherry picked from commit 9b3e617f3df53822345a8573b6d358f6b9e5ed87) Signed-off-by: Luis Henriques Acked-by: Andy Whitcroft --- net/atm/common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/atm/common.c b/net/atm/common.c index 0baf05e..65737b8 100644 --- a/net/atm/common.c +++ b/net/atm/common.c @@ -473,6 +473,8 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, struct sk_buff *skb; int copied, error = -EINVAL; + msg->msg_namelen = 0; + if (sock->state != SS_CONNECTED) return -ENOTCONN; if (flags & ~MSG_DONTWAIT) /* only handle MSG_DONTWAIT */