summaryrefslogtreecommitdiff
path: root/drivers/net/can/usb
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2019-10-01 12:29:13 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2019-11-04 21:47:20 +0100
commit4d6636498c41891d0482a914dd570343a838ad79 (patch)
treeb2fcd4498df3314092a4a1ead3235acc44d4d1a3 /drivers/net/can/usb
parentfb5be6a7b4863ecc44963bb80ca614584b6c7817 (diff)
can: mcba_usb: fix use-after-free on disconnect
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>
Diffstat (limited to 'drivers/net/can/usb')
-rw-r--r--drivers/net/can/usb/mcba_usb.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
index 19a702ac49e4..21faa2ec4632 100644
--- a/drivers/net/can/usb/mcba_usb.c
+++ b/drivers/net/can/usb/mcba_usb.c
@@ -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 = {