]> git.baikalelectronics.ru Git - kernel.git/commit
USB: legousbtower: fix deadlock on disconnect
authorJohan Hovold <johan@kernel.org>
Thu, 19 Sep 2019 08:30:37 +0000 (10:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2019 12:01:56 +0000 (14:01 +0200)
commitb2116ffe646192e5bff9b77e5b18d293dffd98e8
tree4226fb730ccbc08aab137e3e50dde5ad4ecf99ba
parentab32c4b3f11844f2271071d5ee0aaaeaaba8f877
USB: legousbtower: fix deadlock on disconnect

Fix a potential deadlock if disconnect races with open.

Since commit 9ca93873540e ("USB: prevent char device open/deregister
race") core holds an rw-semaphore while open is called and when
releasing the minor number during deregistration. This can lead to an
ABBA deadlock if a driver takes a lock in open which it also holds
during deregistration.

This effectively reverts commit a43bfc259070 ("USB: disconnect open race
in legousbtower") which needlessly introduced this issue after a generic
fix for this race had been added to core by commit 9ca93873540e ("USB:
prevent char device open/deregister race").

Fixes: a43bfc259070 ("USB: disconnect open race in legousbtower")
Cc: stable <stable@vger.kernel.org> # 2.6.24
Reported-by: syzbot+f9549f5ee8a5416f0b95@syzkaller.appspotmail.com
Tested-by: syzbot+f9549f5ee8a5416f0b95@syzkaller.appspotmail.com
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20190919083039.30898-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/misc/legousbtower.c