]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
can: mcba_usb: fix use-after-free on disconnect
authorJohan Hovold <johan@kernel.org>
Tue, 1 Oct 2019 10:29:13 +0000 (12:29 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 4 Nov 2019 20:47:20 +0000 (21:47 +0100)
The driver was accessing its driver data after having freed it.

Fixes: 51f3baad7de9 ("can: mcba_usb: Add support for Microchip CAN BUS Analyzer")
Cc: stable <stable@vger.kernel.org> # 4.12
Cc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>
Reported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/mcba_usb.c

index 19a702ac49e41f76dfbeb0463f13ddccba34c3ae..21faa2ec46327976425e73a8c7d5410b5825906b 100644 (file)
@@ -876,9 +876,8 @@ static void mcba_usb_disconnect(struct usb_interface *intf)
        netdev_info(priv->netdev, "device disconnected\n");
 
        unregister_candev(priv->netdev);
-       free_candev(priv->netdev);
-
        mcba_urb_unlink(priv);
+       free_candev(priv->netdev);
 }
 
 static struct usb_driver mcba_usb_driver = {