can: usb_8dev: Fix memory leak in usb_8dev_start_xmit
authorBjorn Van Tilt <bjorn.vantilt@gmail.com>
Mon, 24 Mar 2014 14:32:08 +0000 (15:32 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 1 Apr 2014 09:54:55 +0000 (11:54 +0200)
Fixed a memory leak when an error occurred in the transmit function. In the
error handling the urb wasn't freed before returning. There was also a call to
the usb_unanchor_urb() function but the urb wasn't anchored.

Signed-off-by: Bjorn Van Tilt <bjorn.vantilt@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/usb_8dev.c

index a0fa1fd..e7247a5 100644 (file)
@@ -697,8 +697,8 @@ static netdev_tx_t usb_8dev_start_xmit(struct sk_buff *skb,
        return NETDEV_TX_OK;
 
 nofreecontext:
-       usb_unanchor_urb(urb);
        usb_free_coherent(priv->udev, size, buf, urb->transfer_dma);
+       usb_free_urb(urb);
 
        netdev_warn(netdev, "couldn't find free context");