can: kvaser_usb: Don't free packets when tight on URBs
authorAhmed S. Darwish <ahmed.darwish@valeo.com>
Mon, 5 Jan 2015 17:49:10 +0000 (12:49 -0500)
committerJiri Slaby <jslaby@suse.cz>
Thu, 29 Jan 2015 14:44:41 +0000 (15:44 +0100)
commitfa5b1bd95f55911436a48d21f9823a1bd026890d
tree85142ba9c3396bafed86b02fd312ec7179a5f674
parent3505b249a4750ba69b0224a5aba6978d321dead4
can: kvaser_usb: Don't free packets when tight on URBs

commit b442723fcec445fb0ae1104888dd22cd285e0a91 upstream.

Flooding the Kvaser CAN to USB dongle with multiple reads and
writes in high frequency caused seemingly-random panics in the
kernel.

On further inspection, it seems the driver erroneously freed the
to-be-transmitted packet upon getting tight on URBs and returning
NETDEV_TX_BUSY, leading to invalid memory writes and double frees
at a later point in time.

Note:

Finding no more URBs/transmit-contexts and returning NETDEV_TX_BUSY
is a driver bug in and out of itself: it means that our start/stop
queue flow control is broken.

This patch only fixes the (buggy) error handling code; the root
cause shall be fixed in a later commit.

Acked-by: Olivier Sobrie <olivier@sobrie.be>
Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/net/can/usb/kvaser_usb.c