ieee802154: atusb: fix use-after-free at disconnect
authorJohan Hovold <johan@kernel.org>
Thu, 19 Sep 2019 12:12:34 +0000 (14:12 +0200)
committerStefan Schmidt <stefan@datenfreihafen.org>
Thu, 19 Sep 2019 14:17:57 +0000 (16:17 +0200)
The disconnect callback was accessing the hardware-descriptor private
data after having having freed it.

Fixes: 7490b008d123 ("ieee802154: add support for atusb transceiver")
Cc: stable <stable@vger.kernel.org> # 4.2
Cc: Alexander Aring <alex.aring@gmail.com>
Reported-by: syzbot+f4509a9138a1472e7e80@syzkaller.appspotmail.com
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
drivers/net/ieee802154/atusb.c

index ceddb424f887d8d714dbdb25749178dc12ca5275..0dd0ba915ab970cf7a142a57279c9271c22c84a9 100644 (file)
@@ -1137,10 +1137,11 @@ static void atusb_disconnect(struct usb_interface *interface)
 
        ieee802154_unregister_hw(atusb->hw);
 
+       usb_put_dev(atusb->usb_dev);
+
        ieee802154_free_hw(atusb->hw);
 
        usb_set_intfdata(interface, NULL);
-       usb_put_dev(atusb->usb_dev);
 
        pr_debug("%s done\n", __func__);
 }