diff options
author | Bjørn Mork <bjorn@mork.no> | 2013-01-28 23:51:28 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-30 17:35:44 -0500 |
commit | 70c37bf97f2a91accba76080db69144f3b69f736 (patch) | |
tree | 2c5b72a06bba90a0cfbf4b1ae93c4ba5d41278ef /include | |
parent | 6cdd20c380eb62eab757c5a6ccc90dac7ecd774b (diff) | |
download | linux-stable-70c37bf97f2a91accba76080db69144f3b69f736.tar.gz linux-stable-70c37bf97f2a91accba76080db69144f3b69f736.tar.bz2 linux-stable-70c37bf97f2a91accba76080db69144f3b69f736.zip |
net: usbnet: prevent buggy devices from killing us
A device sending 0 length frames as fast as it can has been
observed killing the host system due to the resulting memory
pressure.
Temporarily disable RX skb allocation and URB submission when
the current error ratio is high, preventing us from trying to
allocate an infinite number of skbs. Reenable as soon as we
are finished processing the done queue, allowing the device
to continue working after short error bursts.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/usbnet.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 5de7a220e986..0de078d4cdb9 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -33,6 +33,7 @@ struct usbnet { wait_queue_head_t *wait; struct mutex phy_mutex; unsigned char suspend_count; + unsigned char pkt_cnt, pkt_err; /* i/o info: pipes etc */ unsigned in, out; @@ -70,6 +71,7 @@ struct usbnet { # define EVENT_DEV_OPEN 7 # define EVENT_DEVICE_REPORT_IDLE 8 # define EVENT_NO_RUNTIME_PM 9 +# define EVENT_RX_KILL 10 }; static inline struct usb_driver *driver_of(struct usb_interface *intf) |