Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp544442imm; Thu, 5 Jul 2018 05:00:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdzaAHYk32kehuAVzab1x+nxoFx/CCAtPsnNVAnfEMvzgK2DBApJe44sGRA4EC20H6M/2i3 X-Received: by 2002:a63:1315:: with SMTP id i21-v6mr5340112pgl.147.1530792028197; Thu, 05 Jul 2018 05:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530792028; cv=none; d=google.com; s=arc-20160816; b=TzxKEBvqeCdYOwFwR8ahY8kKkiPw85/OlR2I2zwcjQQQUVzdjiX2aCLj7hzMN1+aAu i5rBa/g93zNLGDaPwIqA39WK3lTAqHj2jBXqqJAErBKWlQAxr2+yOX1+a+y6geBCinnV 30MU8YY2+vi/Ljod1Hln3KqnsgYZ531ydZxM7bq/VwGPi86svMCQSyn2+iKLP/zWhGMA J08J9ao8A2qeYXtqmUVuirRw9N5afxBXyevfuolKm9v9kclOSv4KdLIuE5xpEm5Uzlry 3n/fw1j0zLqx59NiWno/xbk+H7ENqybeOvQw1QKBYgGdiIoH/NvE8XGFAVuNR+lsZqjq Q6YA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=kXhqvzIJVUibV5OZyKobv4xfI1HVCGxZ79Hhg3Zejy4=; b=nRcfazCr4W9Omx52AzmVdyc9ArjLH9BDn1UynhTciWAQozWM5cI4g5QC59GNANavOQ kfTdat3D7v1yxQUkGpdgfaG4AG7iSbmmChgG5ZcuMoqWqOGjHaVikRQiowFWpQpZFcF9 ICmrDQ0goIvGBGCL9ZQELfFLrlDhqIZ4Vn89Cp7m6LFH/HnkZOgmy4bIvvKelMQdXJss 0baKHLCwvnCmjDagNJvxrR9m69meN3fG2YgwPtJXm1PlpCbufnHAlpHzeWNTFFpNjsxc 12kKQHYHzATM1rhn88Dd8eVI66gnjHxofl1YBGyk7b7JH0bYKN1bbbjPyHZE9TZg01Jq 1WIA== 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 1-v6si5930126plt.342.2018.07.05.05.00.12; Thu, 05 Jul 2018 05:00:28 -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 S1753978AbeGEL7b (ORCPT + 99 others); Thu, 5 Jul 2018 07:59:31 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:49849 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753661AbeGEL73 (ORCPT ); Thu, 5 Jul 2018 07:59:29 -0400 Received: from [IPv6:2003:e9:d74b:8bb:3252:cbff:fe54:190f] (p200300E9D74B08BB3252CBFFFE54190F.dip0.t-ipconnect.de [IPv6:2003:e9:d74b:8bb:3252:cbff:fe54:190f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@datenfreihafen.org) by proxima.lasnet.de (Postfix) with ESMTPSA id 9C4AEC80E4; Thu, 5 Jul 2018 13:59:27 +0200 (CEST) Subject: Re: [PATCH] 6lowpan: iphc: reset mac_header after decompress to fix panic To: Michael Scott Cc: Alexander Aring , Jukka Rissanen , "David S. Miller" , linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180619234406.8217-1-michael@opensourcefoundries.com> From: Stefan Schmidt Message-ID: <6ab37806-6ff2-bda5-a457-7dffefa1fe08@datenfreihafen.org> Date: Thu, 5 Jul 2018 13:59:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180619234406.8217-1-michael@opensourcefoundries.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On 20.06.2018 01:44, Michael Scott wrote: > 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 > --- > net/6lowpan/iphc.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c > index 6b1042e21656..52fad5dad9f7 100644 > --- a/net/6lowpan/iphc.c > +++ b/net/6lowpan/iphc.c > @@ -770,6 +770,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev, > 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)); This showed no problems in my ieee802154 + 6lowpan tests. Acked-by: Stefan Schmidt regards Stefan Schmidt