Skip to content

Commit 96e8789

Browse files
mike-scottgregkh
authored andcommitted
6lowpan: iphc: reset mac_header after decompress to fix panic
[ Upstream commit 03bc05e ] 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 <[email protected]> Acked-by: Alexander Aring <[email protected]> Acked-by: Jukka Rissanen <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 410534a commit 96e8789

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/6lowpan/iphc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ int lowpan_header_decompress(struct sk_buff *skb, const struct net_device *dev,
770770
hdr.hop_limit, &hdr.daddr);
771771

772772
skb_push(skb, sizeof(hdr));
773+
skb_reset_mac_header(skb);
773774
skb_reset_network_header(skb);
774775
skb_copy_to_linear_data(skb, &hdr, sizeof(hdr));
775776

0 commit comments

Comments
 (0)