]> git.baikalelectronics.ru Git - kernel.git/commit
USB: cdc-acm: fix minor-number release
authorJohan Hovold <johan@kernel.org>
Tue, 7 Sep 2021 08:23:18 +0000 (10:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Sep 2021 08:09:21 +0000 (10:09 +0200)
commitcbbe531cf02304d75abad456aa31c88f82b38760
tree4ef65cbb3d15de38c177ec6ba7a1118914387680
parenta83ac8446ae6764ad625612e15df9735daa4c7fc
USB: cdc-acm: fix minor-number release

commit 91fac0741d4817945c6ee0a17591421e7f5ecb86 upstream.

If the driver runs out of minor numbers it would release minor 0 and
allow another device to claim the minor while still in use.

Fortunately, registering the tty class device of the second device would
fail (with a stack dump) due to the sysfs name collision so no memory is
leaked.

Fixes: 0e97329b2e5a ("usb: cdc-acm: Decrement tty port's refcount if probe() fail")
Cc: stable@vger.kernel.org # 4.19
Cc: Jaejoong Kim <climbbb.kim@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210907082318.7757-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-acm.h