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

Commit 6cec5e2f authored by Hemant Kumar's avatar Hemant Kumar
Browse files

net: usb: Do not modify usbnet device context upon rx complete



Upon rx completion, the driver parses the mux header to identify
the actual net device the IP packet is intended for. At this point
the driver also modifies the usbnet device context to a new usbnet
device, which is derived from the associated IP mux header. This
causes the rx skb queue list corruption when skb is moved
incorrectly from new usbnet device's rx skb queue. Hence do not
overwrite the original usbnet device instance which is required
to move skb from rx skb queue to done queue.

CRs-Fixed: 598321
Change-Id: I642f877dd2f758ddbb868de986dd223bad10eee9
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent a525e5d0
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -381,13 +381,10 @@ static struct sk_buff *rmnet_usb_tx_fixup(struct usbnet *dev,
	return skb;
}

static __be16 rmnet_ip_type_trans(struct sk_buff *skb,
	struct net_device *dev)
static __be16 rmnet_ip_type_trans(struct sk_buff *skb)
{
	__be16	protocol = 0;

	skb->dev = dev;

	switch (skb->data[0] & 0xf0) {
	case 0x40:
		protocol = htons(ETH_P_IP);
@@ -426,7 +423,6 @@ static void rmnet_usb_rx_complete(struct urb *rx_urb)
			/*map urb to actual network iface based on mux id*/
			unet_id = unet_offset + mux_id;
			skb->dev = unet_list[unet_id]->net;
			entry->dev = unet_list[unet_id];
		}
	}

@@ -436,7 +432,7 @@ static void rmnet_usb_rx_complete(struct urb *rx_urb)
static int rmnet_usb_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
{
	if (test_bit(RMNET_MODE_LLP_IP, &dev->data[0]))
		skb->protocol = rmnet_ip_type_trans(skb, dev->net);
		skb->protocol = rmnet_ip_type_trans(skb);
	else /*set zero for eth mode*/
		skb->protocol = 0;