Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f48fc17 authored by William Tu's avatar William Tu Committed by Greg Kroah-Hartman
Browse files

ip_gre: check packet length and mtu correctly in erspan tx




[ Upstream commit f192970de860d3ab90aa9e2a22853201a57bde78 ]

Similarly to early patch for erspan_xmit(), the ARPHDR_ETHER device
is the length of the whole ether packet.  So skb->len should subtract
the dev->hard_header_len.

Fixes: 1a66a836 ("gre: add collect_md mode to ERSPAN tunnel")
Fixes: 84e54fe0 ("gre: introduce native tunnel support for ERSPAN")
Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
Cc: David Laight <David.Laight@aculab.com>
Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6d7bdad1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -579,8 +579,8 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
	if (gre_handle_offloads(skb, false))
		goto err_free_rt;

	if (skb->len > dev->mtu) {
		pskb_trim(skb, dev->mtu);
	if (skb->len > dev->mtu + dev->hard_header_len) {
		pskb_trim(skb, dev->mtu + dev->hard_header_len);
		truncate = true;
	}

@@ -731,8 +731,8 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
	if (skb_cow_head(skb, dev->needed_headroom))
		goto free_skb;

	if (skb->len - dev->hard_header_len > dev->mtu) {
		pskb_trim(skb, dev->mtu);
	if (skb->len > dev->mtu + dev->hard_header_len) {
		pskb_trim(skb, dev->mtu + dev->hard_header_len);
		truncate = true;
	}