can: gs_usb: gs_destroy_candev(): fix use after free

This patch fixes a use after free of "dev" in gs_destroy_candev().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde 2014-05-21 10:06:02 +02:00
parent 2a7ede5407
commit cf68f517c5

View File

@ -826,8 +826,8 @@ static void gs_destroy_candev(struct gs_can *dev)
{ {
unregister_candev(dev->netdev); unregister_candev(dev->netdev);
free_candev(dev->netdev); free_candev(dev->netdev);
kfree(dev);
usb_kill_anchored_urbs(&dev->tx_submitted); usb_kill_anchored_urbs(&dev->tx_submitted);
kfree(dev);
} }
static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)