staging: gdm724x: gdm_mux: fix use-after-free on module unload
authorJohan Hovold <johan@kernel.org>
Wed, 26 Apr 2017 10:23:04 +0000 (12:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Apr 2017 10:32:49 +0000 (12:32 +0200)
Make sure to deregister the USB driver before releasing the tty driver
to avoid use-after-free in the USB disconnect callback where the tty
devices are deregistered.

Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver")
Cc: stable <stable@vger.kernel.org> # 3.12
Cc: Won Kang <wkang77@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm724x/gdm_mux.c

index aba32e22db0c0a9cea051d321d48d3856422c22d..996b1f538aae1c5f25de0f89e32baf07d612482d 100644 (file)
@@ -664,9 +664,8 @@ static int __init gdm_usb_mux_init(void)
 
 static void __exit gdm_usb_mux_exit(void)
 {
-       unregister_lte_tty_driver();
-
        usb_deregister(&gdm_mux_driver);
+       unregister_lte_tty_driver();
 }
 
 module_init(gdm_usb_mux_init);