Skip to contentSkip to conversation

Patch "usbnet: fix alignment for frames with no ethernet header" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 14, 2017

Subsystems (6)
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

usbnet: fix alignment for frames with no ethernet header

to the 4.14-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:
usbnet-fix-alignment-for-frames-with-no-ethernet-header.patch
and it can be found in the queue-4.14 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 Thu Dec 14 11:45:40 CET 2017

From: Bj�rn Mork <[email protected]>
Date: Wed, 6 Dec 2017 20:21:24 +0100
Subject: usbnet: fix alignment for frames with no ethernet header

From: Bj�rn Mork <[email protected]>

[ Upstream commit a4abd7a80addb4a9547f7dfc7812566b60ec505c ]

The qmi_wwan minidriver support a 'raw-ip' mode where frames are received without any ethernet header. This causes alignment issues because the skbs allocated by usbnet are "IP aligned".

Fix by allowing minidrivers to disable the additional alignment offset. This is implemented using a per-device flag, since the same minidriver also supports 'ethernet' mode.

Fixes 32f7adf633b9 ("net: qmi_wwan: support "raw IP" mode")
Reported-and-tested-by Jay Foster <[email protected]>
---
 drivers/net/usb/qmi_wwan.c |    2 ++
 drivers/net/usb/usbnet.c   |    5 ++++-
 include/linux/usb/usbnet.h |    1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/usb/qmi_wwan.c +2 -0
@@ -261,9 +261,11 @@ static void qmi_wwan_netdev_setup(struct
 		net->hard_header_len = 0;
 		net->addr_len        = 0;
 		net->flags           = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
+		set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: raw IP\n");
 	} else if (!net->header_ops) { /* don't bother if already set */
 		ether_setup(net);
+		clear_bit(EVENT_NO_IP_ALIGN, &dev->flags);
 		netdev_dbg(net, "mode: Ethernet\n");
 	}
 
drivers/net/usb/usbnet.c +4 -1
@@ -484,7 +484,10 @@ static int rx_submit (struct usbnet *dev
 		return -ENOLINK;
 	}
 
-	skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
+	if (test_bit(EVENT_NO_IP_ALIGN, &dev->flags))
+		skb = __netdev_alloc_skb(dev->net, size, flags);
+	else
+		skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
 	if (!skb) {
 		netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
 		usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
include/linux/usb/usbnet.h +1 -0
@@ -81,6 +81,7 @@ struct usbnet {
 #		define EVENT_RX_KILL	10
 #		define EVENT_LINK_CHANGE	11
 #		define EVENT_SET_RX_MODE	12
+#		define EVENT_NO_IP_ALIGN	13
 };
 
 static inline struct usb_driver *driver_of(struct usb_interface *intf)

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

queue-4.14/usbnet-fix-alignment-for-frames-with-no-ethernet-header.patch queue-4.14/net-qmi_wwan-add-quectel-bg96-2c7c-0296.patch