Commit 3a8d3b36 authored by Brian King's avatar Brian King Committed by Greg Kroah-Hartman

hvcs: Get reference to tty in remove

Grab a reference to the tty when removing the hvcs to ensure
it does not get freed unexpectedly.
Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Link: https://lore.kernel.org/r/20230203155802.404324-4-brking@linux.vnet.ibm.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 503a90dd
......@@ -799,7 +799,7 @@ static void hvcs_remove(struct vio_dev *dev)
spin_lock_irqsave(&hvcsd->lock, flags);
tty = hvcsd->port.tty;
tty = tty_port_tty_get(&hvcsd->port);
spin_unlock_irqrestore(&hvcsd->lock, flags);
......@@ -814,8 +814,10 @@ static void hvcs_remove(struct vio_dev *dev)
* hvcs_hangup. The tty should always be valid at this time unless a
* simultaneous tty close already cleaned up the hvcs_struct.
*/
if (tty)
if (tty) {
tty_hangup(tty);
tty_kref_put(tty);
}
printk(KERN_INFO "HVCS: vty-server@%X removed from the"
" vio bus.\n", dev->unit_address);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment