Received: by 10.192.165.156 with SMTP id m28csp39238imm; Tue, 10 Apr 2018 15:57:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+VDBvCXQnJmQ7nzOl0sfgPRwbm97QDTrq13Rn1II2gS3E167Dp3y1SV1XfuAey9qOwA94V X-Received: by 10.101.74.69 with SMTP id a5mr1670583pgu.32.1523401039885; Tue, 10 Apr 2018 15:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401039; cv=none; d=google.com; s=arc-20160816; b=tHufSaNzChBZmIUHPHzd876Vzlznc4oCdJH11a5KCD3q7Wyy2Dnyz1w0h3Px7HTFcX 0F6lHxw9jQPjXm5wLNbTXYKw6jdt8/QfXi6g6uEj2vtL+BtwO5x9rDD5wtsI+rQ4F8Zz 2uJ5+JI6l/gudbSFnVBlGPuys+WPtkKwQ7QSv8oNU+/iwblJ0Lk4SXylxl/Q/66hpevh rOAc96CwGEDIVEroz7qR0D7p/fbZjfCwjCpp4muq7DMwYdrSprvaI38+iqjdqF2+6inQ bc5MibEF5fTFGvve9YAyTxYGmZQVDialqCCza3DWWy0YJ5neo5EwwBVc8i7poG7Ga67Y qvvw== 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=up1rpEsFgUT0wQjYcYdpEKuDrAFHMDlSZkQbyGXIVts=; b=AxnGWemCP3jCwtz0F5v0uMOY9BBMuVpwnAO0aR6m/tkM7M8CCHbiOHWwyit7UwqKib hee1T25EgKLP04871x7wooLtl6Emtan4lIFnKIP3WJpjIxI5RWg43CW57Mtual4r5Egq 276JYy5hGn9+y8NDmmmM6ccQ7D9NBIF7VxleAHy3gFpMpI53u/4u7lHKkZh12Y0neOMz 548IhfcIYRg1rddkmnyxHb/IyrXMRwRXwL4DiLw9rk4LgyvzpJX+s/aV6u49bsrgPO51 G7ftD0v9KYwR1tcuo73zfHGkzZT6qdS27Gw8y1WTpmktxxCXWWX6VabpfY87O/R1iJpq ILTw== 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-v6si3583784pld.23.2018.04.10.15.56.36; Tue, 10 Apr 2018 15:57:19 -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 S932512AbeDJWvV (ORCPT + 99 others); Tue, 10 Apr 2018 18:51:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44458 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754451AbeDJWiJ (ORCPT ); Tue, 10 Apr 2018 18:38:09 -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 C07D3D31; Tue, 10 Apr 2018 22:38:08 +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.14 100/138] net: fix possible out-of-bound read in skb_network_protocol() Date: Wed, 11 Apr 2018 00:24:50 +0200 Message-Id: <20180410212913.781390050@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@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.14-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 @@ -2696,7 +2696,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; }