Skip to contentSkip to conversation

Patch "macvtap: always pass ethernet header in linear" has been added to the 4.5-stable tree

PATCH [email protected] 1 participant 1 message Apr 16, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

macvtap: always pass ethernet header in linear

to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
macvtap-always-pass-ethernet-header-in-linear.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Sat Apr 16 09:15:18 PDT 2016

From: Willem de Bruijn <[email protected]>
Date: Tue, 8 Mar 2016 15:18:54 -0500
Subject: macvtap: always pass ethernet header in linear

From: Willem de Bruijn <[email protected]>

[ Upstream commit 8e2ad4113ce4671686740f808ff2795395c39eef ]

The stack expects link layer headers in the skb linear section. Macvtap can create skbs with llheader in frags in edge cases:
when (IFF_VNET_HDR is off or vnet_hdr.hdr_len < ETH_HLEN) and prepad + len > PAGE_SIZE and vnet_hdr.flags has no or bad csum.

Add checks to ensure linear is always at least ETH_HLEN. At this point, len is already ensured to be >= ETH_HLEN.

For backwards compatiblity, rounds up short vnet_hdr.hdr_len. This differs from tap and packet, which return an error.

Fixes b9fb9ee07e67 ("macvtap: add GSO/csum offload support")

---
 drivers/net/macvtap.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/macvtap.c +6 -3
@@ -760,6 +760,8 @@ static ssize_t macvtap_get_user(struct m
 			macvtap16_to_cpu(q, vnet_hdr.hdr_len) : GOODCOPY_LEN;
 		if (copylen > good_linear)
 			copylen = good_linear;
+		else if (copylen < ETH_HLEN)
+			copylen = ETH_HLEN;
 		linear = copylen;
 		i = *from;
 		iov_iter_advance(&i, copylen);
@@ -769,10 +771,11 @@ static ssize_t macvtap_get_user(struct m
 
 	if (!zerocopy) {
 		copylen = len;
-		if (macvtap16_to_cpu(q, vnet_hdr.hdr_len) > good_linear)
+		linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len);
+		if (linear > good_linear)
 			linear = good_linear;
-		else
-			linear = macvtap16_to_cpu(q, vnet_hdr.hdr_len);
+		else if (linear < ETH_HLEN)
+			linear = ETH_HLEN;
 	}
 
 	skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen,

Patches currently in stable-queue which might be from [email protected] are

queue-4.5/ax25-add-link-layer-header-validation-function.patch queue-4.5/net-validate-variable-length-ll-headers.patch queue-4.5/packet-validate-variable-length-ll-headers.patch queue-4.5/macvtap-always-pass-ethernet-header-in-linear.patch queue-4.5/ipv6-udp-fix-udp_mib_ignoredmulti-updates.patch