From cf68f517c5c5041e3f3de502dccb008ec21f7262 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 21 May 2014 10:06:02 +0200 Subject: [PATCH] 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 --- drivers/net/can/usb/gs_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.20.1