]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
USB: cdc-wdm: fix race between write and disconnect due to flag abuse
authorOliver Neukum <oneukum@suse.com>
Tue, 27 Aug 2019 10:34:36 +0000 (12:34 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
commit1a3d2018eb0f54d745151fae2ed774f8fb88a455
tree0aeb457c2d514793eb5b2cf7c4372ad7a6462f83
parentcf9934a72f20d61afa6df6a9fbc5cb814d9201d4
USB: cdc-wdm: fix race between write and disconnect due to flag abuse

BugLink: https://bugs.launchpad.net/bugs/1843338
commit 1426bd2c9f7e3126e2678e7469dca9fd9fc6dd3e upstream.

In case of a disconnect an ongoing flush() has to be made fail.
Nevertheless we cannot be sure that any pending URB has already
finished, so although they will never succeed, they still must
not be touched.
The clean solution for this is to check for WDM_IN_USE
and WDM_DISCONNECTED in flush(). There is no point in ever
clearing WDM_IN_USE, as no further writes make sense.

The issue is as old as the driver.

Fixes: afba937e540c9 ("USB: CDC WDM driver")
Reported-by: syzbot+d232cca6ec42c2edb3fc@syzkaller.appspotmail.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20190827103436.21143-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/class/cdc-wdm.c