Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1329669imm; Tue, 2 Oct 2018 06:37:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV62uwvgajiwDQGFl1tTuFA6bATy3l70RVavD4GGHGFQS+ya24oD8iTTl4bjCTfNrmQnuhoXw X-Received: by 2002:a62:7f8c:: with SMTP id a134-v6mr16371890pfd.257.1538487443169; Tue, 02 Oct 2018 06:37:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538487443; cv=none; d=google.com; s=arc-20160816; b=ijVm8F9BEhR6fneauvmnGTMKUDHV8c7hdUbX5rUjzMNhj2iJ1opn4ao1yD27ptUxd/ fEEfNjKA4XXnnb9n9qq38SFIwSXk0qLUSTpzPXm/odSQgt/aq+C3Eiu8JPLPTolSaysg /NijtjBSJ4TS6897q16HX6meWEA9aZlHDPnErtWhvenYHMpUug6CWJ/BOROenJy6Q4WZ Ou67e7OS6T0UNyqhiiBjuaedXhOelvTTe5jdN0nMkxX1x7MXmsHWUZ+uyF9CJgcl/K/U 6rnvwsmlinIFoMvJriM0aEdgwMW51KB2S+O56Gu7ZE5Q29qM1TevF5RxGq6GlhO2tH88 ER2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=DHDWxiR57IOjepuqftatSssKWdVmNK1YMVU0ElKch3g=; b=w2v5IpZgXSwUwIJ9dXdzlO9b82SJZ0nONeKbZXJAivMjhiAb1ZGaMzN7zzrI5aZhn9 QePr/51rOzJK+Zh1rAwguUX63soCtNZ192cgMAN11tlzr0RCt11W52vHAV1GOgYqHlXE Zspb+Gtqt28J/kYKW39CWfnabxC9qpqWrzbMr7ShdXr//Ym7g7mtxQIkFgP9FcVOhL+M DFF9+8Ze7nhCKFVLqa/HZqbCklynlXOnFSPeOX7bJrt56wFegLS2HUnXFvBDm1X25/qb EsLCQPf1iVb6bOV9yhLCCg3o5la0P7zzXHTzbNLKvgUz1Seo3KIK50RkvAz5QkozJl20 ki5w== 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 185-v6si6051345pff.270.2018.10.02.06.37.08; Tue, 02 Oct 2018 06:37:23 -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 S1732248AbeJBUT5 (ORCPT + 99 others); Tue, 2 Oct 2018 16:19:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36302 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731726AbeJBUT4 (ORCPT ); Tue, 2 Oct 2018 16:19:56 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 831D4B4B; Tue, 2 Oct 2018 13:36:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Scott , Alexander Aring , Jukka Rissanen , Marcel Holtmann , Sasha Levin Subject: [PATCH 4.9 11/94] 6lowpan: iphc: reset mac_header after decompress to fix panic Date: Tue, 2 Oct 2018 06:24:25 -0700 Message-Id: <20181002132501.268431054@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132500.494838053@linuxfoundation.org> References: <20181002132500.494838053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Michael Scott [ Upstream commit 03bc05e1a4972f73b4eb8907aa373369e825c252 ] After decompression of 6lowpan socket data, an IPv6 header is inserted before the existing socket payload. After this, we reset the network_header value of the skb to account for the difference in payload size from prior to decompression + the addition of the IPv6 header. However, we fail to reset the mac_header value. Leaving the mac_header value untouched here, can cause a calculation error in net/packet/af_packet.c packet_rcv() function when an AF_PACKET socket is opened in SOCK_RAW mode for use on a 6lowpan interface. On line 2088, the data pointer is moved backward by the value returned from skb_mac_header(). If skb->data is adjusted so that it is before the skb->head pointer (which can happen when an old value of mac_header is left in place) the kernel generates a panic in net/core/skbuff.c line 1717. This panic can be generated by BLE 6lowpan interfaces (such as bt0) and 802.15.4 interfaces (such as lowpan0) as they both use the same 6lowpan sources for compression and decompression. Signed-off-by: Michael Scott Acked-by: Alexander Aring Acked-by: Jukka Rissanen Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/6lowpan/iphc.c | 1 + 1 file changed, 1 insertion(+) --- a/net/6lowpan/iphc.c +++ b/net/6lowpan/iphc.c @@ -745,6 +745,7 @@ int lowpan_header_decompress(struct sk_b hdr.hop_limit, &hdr.daddr); skb_push(skb, sizeof(hdr)); + skb_reset_mac_header(skb); skb_reset_network_header(skb); skb_copy_to_linear_data(skb, &hdr, sizeof(hdr));