Received: by 10.192.165.156 with SMTP id m28csp1099899imm; Wed, 11 Apr 2018 12:24:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx495yiTALpfZbfMeyuuRydo8YlfjgEfQ+EczyA0Dqe3EyLof/ud1Q2LDyhHxIPrHQWf3eSrx X-Received: by 10.99.60.6 with SMTP id j6mr4252449pga.73.1523474651778; Wed, 11 Apr 2018 12:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523474651; cv=none; d=google.com; s=arc-20160816; b=eZDyUoflxDFdu0yBeH3IB4jsfuGmZMfhHAM3LOLgn8KrpgG72jxz/PkKd2nofVYrRA x6+SzFv7jSzkQN8RKn6YiA+WfHz/C6R891p2FlNoVRE7wm3t3MRaxocOE8T86n3LGh/P z62Nc8L8aSOZfrZNQCRnxw3AX5MckSy7vJh+82eIOBFMgIewZ1ZSrTRoLUAVuGRsgv70 UXT29qzC/za4A9BxNA7Wl3AWGZzUX1VRRMDb5ESbY5/pO5F/2CQCBd1pXBLPutZG4flH 7XV8A9WcRZuqCkBucS1YOruNS8P/Chh/jXzPQJKVVkE6dmCDqJHkBFvBytlA8G8a12vz rRww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=u1JDAEdFiiLsDRmygSYiizYlbrnJ6uax7QG9bzeCjE4=; b=iDuSJNtMorSkVW/2LRcUL18Vq0yQOKWRGN0TMNF7EZUzxOSzP1W17UamfNX8PVlp44 oNAd9pvNvgXlzi9R+Gq9H6U6RcYNX25391OBD/RRQx8xZ30zKGF65pDzB2/6wuWVNcsn pW9eg43fnmWrIbaatmBm8gesDqpCsaPExOHDcYe17o3JhsFUwa4oWGbuW/xxb4XZC+W0 EBPx8lcWOdQuKwpv2+1QZsUKSaAQ/9UsctRQCsUp2MCvPcyFYVxf2zoPybKcBIwfISVz G1zq07LQXFJal99sPYi99sau2Qr150ltiTiFMPcdcdVBGv45To6r82d7Zy5wCaY0f0gB /DXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d63-v6si1739665pld.23.2018.04.11.12.23.35; Wed, 11 Apr 2018 12:24:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932114AbeDKTPm (ORCPT + 99 others); Wed, 11 Apr 2018 15:15:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40456 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935019AbeDKTFY (ORCPT ); Wed, 11 Apr 2018 15:05:24 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B7591CD1; Wed, 11 Apr 2018 19:05:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Pravin B Shelar , "Reported-by: syzbot" , "David S. Miller" Subject: [PATCH 4.9 278/310] net: fix possible out-of-bound read in skb_network_protocol() Date: Wed, 11 Apr 2018 20:36:57 +0200 Message-Id: <20180411183634.583796554@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 1dfe82ebd7d8fd43dba9948fdfb31f145014baa0 ] skb mac header is not necessarily set at the time skb_network_protocol() is called. Use skb->data instead. BUG: KASAN: slab-out-of-bounds in skb_network_protocol+0x46b/0x4b0 net/core/dev.c:2739 Read of size 2 at addr ffff8801b3097a0b by task syz-executor5/14242 CPU: 1 PID: 14242 Comm: syz-executor5 Not tainted 4.16.0-rc6+ #280 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x24d lib/dump_stack.c:53 print_address_description+0x73/0x250 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x23c/0x360 mm/kasan/report.c:412 __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report.c:443 skb_network_protocol+0x46b/0x4b0 net/core/dev.c:2739 harmonize_features net/core/dev.c:2924 [inline] netif_skb_features+0x509/0x9b0 net/core/dev.c:3011 validate_xmit_skb+0x81/0xb00 net/core/dev.c:3084 validate_xmit_skb_list+0xbf/0x120 net/core/dev.c:3142 packet_direct_xmit+0x117/0x790 net/packet/af_packet.c:256 packet_snd net/packet/af_packet.c:2944 [inline] packet_sendmsg+0x3aed/0x60b0 net/packet/af_packet.c:2969 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg+0xca/0x110 net/socket.c:639 ___sys_sendmsg+0x767/0x8b0 net/socket.c:2047 __sys_sendmsg+0xe5/0x210 net/socket.c:2081 Fixes: 19acc327258a ("gso: Handle Trans-Ether-Bridging protocol in skb_network_protocol()") Signed-off-by: Eric Dumazet Cc: Pravin B Shelar Reported-by: Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2667,7 +2667,7 @@ __be16 skb_network_protocol(struct sk_bu if (unlikely(!pskb_may_pull(skb, sizeof(struct ethhdr)))) return 0; - eth = (struct ethhdr *)skb_mac_header(skb); + eth = (struct ethhdr *)skb->data; type = eth->h_proto; }