Thread (1 message) 1 message, 1 author, 2013-01-24

Re: [RFC] net: usbnet: prevent buggy devices from killing us

From: Joe Perches <hidden>
Date: 2013-01-24 13:01:09

On Thu, 2013-01-24 at 16:39 +0400, Sergei Shtylyov wrote:
On 24-01-2013 14:25, Bjørn Mork wrote:
quoted
A device sending 0 length frames as fast as it can has been
observed killing the host system due to the resulting memory
pressure.
[]
quoted
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
[]
quoted
+	/* Do not let a device flood us to death! */
+	if (dev->done.qlen > 1024) {
+		netif_dbg(dev, rx_err, dev->net, "done queue filling up (%u) - throttling\n", dev->done.qlen);
+		usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
+		usb_free_urb (urb);
    Run your patch thru scripts/checkpatch.pl please
And maybe ratelimit the netif_dbg

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help