This is a note to let you know that I've just added the patch titled ipack: ipoctal: fix tty registration race 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: ipack-ipoctal-fix-tty-registration-race.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 65c001df517a7bf9be8621b53d43c89f426ce8d6 Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan@xxxxxxxxxx> Date: Fri, 17 Sep 2021 13:46:18 +0200 Subject: ipack: ipoctal: fix tty registration race From: Johan Hovold <johan@xxxxxxxxxx> commit 65c001df517a7bf9be8621b53d43c89f426ce8d6 upstream. Make sure to set the tty class-device driver data before registering the tty to avoid having a racing open() dereference a NULL pointer. Fixes: 9c1d784afc6f ("Staging: ipack/devices/ipoctal: Get rid of ipoctal_list.") Cc: stable@xxxxxxxxxxxxxxx # 3.7 Acked-by: Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Link: https://lore.kernel.org/r/20210917114622.5412-3-johan@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/ipack/devices/ipoctal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -393,13 +393,13 @@ static int ipoctal_inst_slot(struct ipoc spin_lock_init(&channel->lock); channel->pointer_read = 0; channel->pointer_write = 0; - tty_dev = tty_port_register_device(&channel->tty_port, tty, i, NULL); + tty_dev = tty_port_register_device_attr(&channel->tty_port, tty, + i, NULL, channel, NULL); if (IS_ERR(tty_dev)) { dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n"); tty_port_destroy(&channel->tty_port); continue; } - dev_set_drvdata(tty_dev, channel); } /* Patches currently in stable-queue which might be from johan@xxxxxxxxxx are queue-5.14/ipack-ipoctal-fix-stack-information-leak.patch queue-5.14/ipack-ipoctal-fix-tty-registration-race.patch queue-5.14/ipack-ipoctal-fix-module-reference-leak.patch queue-5.14/ipack-ipoctal-fix-missing-allocation-failure-check.patch queue-5.14/ipack-ipoctal-fix-tty-registration-error-handling.patch