lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 06 Sep 2012 11:22:16 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Oliver Neukum <oneukum@...e.de>
Cc:	Alexey ORISHKO <alexey.orishko@...ricsson.com>,
	"bjorn@...k.no" <bjorn@...k.no>, Ming Lei <tom.leiming@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	Alexey Orishko <alexey.orishko@...il.com>
Subject: Re: changing usbnet's API to better deal with cdc-ncm

On Thu, 2012-09-06 at 11:11 +0200, Eric Dumazet wrote:

> Really skb_clone() use should be removed from cdc_ncm_rx_fixup()
> 
> Unless you expect 10Gbit speed from this driver, skb_clone() is the
> worst possible strategy.
> 
> Allocating fresh skbs of the right size permits better memory use and
> allows TCP coalescing as well.
> 
> The use of skb_clone() forces some parts of the stack to perform a full
> copy anyway.
> 
> It's still unclear to me with we use up to 32KB blocks in USB drivers...
> 

So I advise testing this patch :

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 4cd582a..c0821f7 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1052,12 +1052,11 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
 			break;
 
 		} else {
-			skb = skb_clone(skb_in, GFP_ATOMIC);
+			skb = netdev_alloc_skb_ip_align(dev->net, len);
 			if (!skb)
 				goto error;
-			skb->len = len;
-			skb->data = ((u8 *)skb_in->data) + offset;
-			skb_set_tail_pointer(skb, len);
+			skb_put(skb, len);
+			memcpy(skb->data, skb_in->data + offset, len);
 			usbnet_skb_return(dev, skb);
 		}
 	}


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ