From: Marc Kleine-Budde Date: Wed, 21 May 2014 08:06:02 +0000 (+0200) Subject: can: gs_usb: gs_destroy_candev(): fix use after free X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cf68f517c5c5041e3f3de502dccb008ec21f7262;p=linux-beck.git 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 Signed-off-by: Marc Kleine-Budde --- diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index c9f1f99682b1..04b0f84612f0 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -826,8 +826,8 @@ static void gs_destroy_candev(struct gs_can *dev) { unregister_candev(dev->netdev); free_candev(dev->netdev); - kfree(dev); usb_kill_anchored_urbs(&dev->tx_submitted); + kfree(dev); } static int gs_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)