diff options
author | Johan Hovold <johan@kernel.org> | 2021-09-07 10:23:18 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-14 10:33:40 +0200 |
commit | 91fac0741d4817945c6ee0a17591421e7f5ecb86 (patch) | |
tree | b97569403ea5fd415a50f7b655f2f912fabcc3b5 /drivers/usb/class/cdc-acm.h | |
parent | 856e6e8e0f9300befa87dde09edb578555c99a82 (diff) | |
download | linux-stable-91fac0741d4817945c6ee0a17591421e7f5ecb86.tar.gz linux-stable-91fac0741d4817945c6ee0a17591421e7f5ecb86.tar.bz2 linux-stable-91fac0741d4817945c6ee0a17591421e7f5ecb86.zip |
USB: cdc-acm: fix minor-number release
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: cae2bc768d17 ("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>
Diffstat (limited to 'drivers/usb/class/cdc-acm.h')
-rw-r--r-- | drivers/usb/class/cdc-acm.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index 8aef5eb769a0..3aa7f0a3ad71 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h @@ -22,6 +22,8 @@ #define ACM_TTY_MAJOR 166 #define ACM_TTY_MINORS 256 +#define ACM_MINOR_INVALID ACM_TTY_MINORS + /* * Requests. */ |