From patchwork Sun Apr 7 11:51:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Krause X-Patchwork-Id: 234484 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 926852C0098 for ; Sun, 7 Apr 2013 21:52:41 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933511Ab3DGLwh (ORCPT ); Sun, 7 Apr 2013 07:52:37 -0400 Received: from mail-bk0-f42.google.com ([209.85.214.42]:61228 "EHLO mail-bk0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933504Ab3DGLwf (ORCPT ); Sun, 7 Apr 2013 07:52:35 -0400 Received: by mail-bk0-f42.google.com with SMTP id jc3so2710234bkc.1 for ; Sun, 07 Apr 2013 04:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=aFlNM69XzFDErSuGHmrQwR8wWVU97aM+yEuGDOh6XMI=; b=bSaT25wEJlWAYCNia6LWJuoaluhpU877L+JGiHAR06HOE8epZEqkHGE9qeRkFSBzI5 eBXR+6kxz8wr6vgiKXu3eACDoAckXDOhKTefwyy0ferZqYfx7lIMDyQYj1BhWj22AJFu Ksa/lBA+oGVKpa2i1Dn6bEwSzg/oNAMlxq+IddBdwWfmrDmOYpXPnH0CGvP+ztPsFKWD mt2k1x5A2HS+OQYTp10jBvA3xC2BLm/wSzFO3PdyF9hIuIyUuKj8YKlxBKXp+YDJKUrs 0eVgirNxyPz73pZEgbAoDaSyVnioHEGJTfAoAZZ8aXp8EAIIb3hs0BJmzPV4C6i6AJba tSYg== X-Received: by 10.205.71.6 with SMTP id yi6mr9563396bkb.8.1365335554127; Sun, 07 Apr 2013 04:52:34 -0700 (PDT) Received: from jig.fritz.box (pD9EB4E1C.dip.t-dialin.net. [217.235.78.28]) by mx.google.com with ESMTPS id da16sm1974758bkb.2.2013.04.07.04.52.32 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 07 Apr 2013 04:52:33 -0700 (PDT) From: Mathias Krause To: "David S. Miller" Cc: netdev@vger.kernel.org, Allan Stephens , Aloisio Almeida Jr , Andy King , Arnaldo Carvalho de Melo , Dmitry Torokhov , George Zhang , Gustavo Padovan , Johan Hedberg , Jon Maloy , Lauro Ramos Venancio , Marcel Holtmann , Ralf Baechle , Samuel Ortiz , Samuel Ortiz , Sjur Braendeland , Ursula Braun , Brad Spengler , Mathias Krause Subject: [PATCH 09/16] l2tp: fix info leak in l2tp_ip6_recvmsg() Date: Sun, 7 Apr 2013 13:51:55 +0200 Message-Id: <1365335522-29931-10-git-send-email-minipli@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1365335522-29931-1-git-send-email-minipli@googlemail.com> References: <1365335522-29931-1-git-send-email-minipli@googlemail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The L2TP code for IPv6 fails to initialize the l2tp_conn_id member of struct sockaddr_l2tpip6 and therefore leaks four bytes kernel stack in l2tp_ip6_recvmsg() in case msg_name is set. Initialize l2tp_conn_id with 0 to avoid the info leak. Signed-off-by: Mathias Krause --- net/l2tp/l2tp_ip6.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index c74f5a9..b8a6039 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -690,6 +690,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, lsa->l2tp_addr = ipv6_hdr(skb)->saddr; lsa->l2tp_flowinfo = 0; lsa->l2tp_scope_id = 0; + lsa->l2tp_conn_id = 0; if (ipv6_addr_type(&lsa->l2tp_addr) & IPV6_ADDR_LINKLOCAL) lsa->l2tp_scope_id = IP6CB(skb)->iif; }