This is a note to let you know that I've just added the patch titled net: hso: fix muxed tty registration to the 5.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-hso-fix-muxed-tty-registration.patch and it can be found in the queue-5.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e8f69b16ee776da88589b5271e3f46020efc8f6c Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan@xxxxxxxxxx> Date: Fri, 17 Sep 2021 12:12:04 +0200 Subject: net: hso: fix muxed tty registration From: Johan Hovold <johan@xxxxxxxxxx> commit e8f69b16ee776da88589b5271e3f46020efc8f6c upstream. If resource allocation and registration fail for a muxed tty device (e.g. if there are no more minor numbers) the driver should not try to deregister the never-registered (or already-deregistered) tty. Fix up the error handling to avoid dereferencing a NULL pointer when attempting to remove the character device. Fixes: 72dc1c096c70 ("HSO: add option hso driver") Cc: stable@xxxxxxxxxxxxxxx # 2.6.27 Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/usb/hso.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -2720,14 +2720,14 @@ struct hso_device *hso_create_mux_serial serial = kzalloc(sizeof(*serial), GFP_KERNEL); if (!serial) - goto exit; + goto err_free_dev; hso_dev->port_data.dev_serial = serial; serial->parent = hso_dev; if (hso_serial_common_create (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) - goto exit; + goto err_free_serial; serial->tx_data_length--; serial->write_data = hso_mux_serial_write_data; @@ -2743,11 +2743,9 @@ struct hso_device *hso_create_mux_serial /* done, return it */ return hso_dev; -exit: - if (serial) { - tty_unregister_device(tty_drv, serial->minor); - kfree(serial); - } +err_free_serial: + kfree(serial); +err_free_dev: kfree(hso_dev); return NULL; Patches currently in stable-queue which might be from johan@xxxxxxxxxx are queue-5.14/misc-bcm-vk-fix-tty-registration-race.patch queue-5.14/usb-serial-option-add-device-id-for-foxconn-t99w265.patch queue-5.14/usb-serial-cp210x-add-id-for-gw-instek-gdm-834x-digital-multimeter.patch queue-5.14/net-hso-fix-muxed-tty-registration.patch queue-5.14/usb-serial-mos7840-remove-duplicated-0xac24-device-id.patch queue-5.14/staging-greybus-uart-fix-tty-use-after-free.patch queue-5.14/usb-cdc-acm-fix-minor-number-release.patch queue-5.14/usb-serial-option-add-telit-ln920-compositions.patch queue-5.14/usb-serial-option-remove-duplicate-usb-device-id.patch