]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
USB: iowarrior: fix use-after-free on disconnect
authorJohan Hovold <johan@kernel.org>
Wed, 9 Oct 2019 10:48:41 +0000 (12:48 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 12 Nov 2019 18:04:32 +0000 (19:04 +0100)
commite03b0c4a6e0684b29e416c0a19e6837047824545
treeb8b75213307cabb15f1fce992f206dabea3b8f60
parent0977f356b1fe3d67ac279cfebc920d7f969b1e2e
USB: iowarrior: fix use-after-free on disconnect

BugLink: https://bugs.launchpad.net/bugs/1850541
commit edc4746f253d907d048de680a621e121517f484b upstream.

A recent fix addressing a deadlock on disconnect introduced a new bug
by moving the present flag out of the critical section protected by the
driver-data mutex. This could lead to a racing release() freeing the
driver data before disconnect() is done with it.

Due to insufficient locking a related use-after-free could be triggered
also before the above mentioned commit. Specifically, the driver needs
to hold the driver-data mutex also while checking the opened flag at
disconnect().

Fixes: c468a8aa790e ("usb: iowarrior: fix deadlock on disconnect")
Fixes: 946b960d13c1 ("USB: add driver for iowarrior devices.")
Cc: stable <stable@vger.kernel.org> # 2.6.21
Reported-by: syzbot+0761012cebf7bdb38137@syzkaller.appspotmail.com
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191009104846.5925-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/usb/misc/iowarrior.c