diff options
author | Brian King <brking@linux.vnet.ibm.com> | 2023-02-01 13:57:38 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-02 11:51:03 +0100 |
commit | 6a9a733edd46732e906d976dc21a42dd361e53cc (patch) | |
tree | 2236626b4f6394c2b4ae5c8a28d8472ecd814cbd /drivers/tty/hvc/hvcs.c | |
parent | 2115a84d3688faef106abd19581a5a3b77845824 (diff) | |
download | linux-stable-6a9a733edd46732e906d976dc21a42dd361e53cc.tar.gz linux-stable-6a9a733edd46732e906d976dc21a42dd361e53cc.tar.bz2 linux-stable-6a9a733edd46732e906d976dc21a42dd361e53cc.zip |
hvcs: Fix hvcs port reference counting
The hvcs driver only ever gets two references to the port. One
at initialization time, and one at install time. Remove the code
that was trying to do multiple port puts for each open, which
would result in more puts than gets.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Link: https://lore.kernel.org/r/20230201195743.303163-2-brking@linux.vnet.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/hvc/hvcs.c')
-rw-r--r-- | drivers/tty/hvc/hvcs.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index 4ba24963685e..faf5ccfc561e 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c @@ -1215,12 +1215,9 @@ static void hvcs_hangup(struct tty_struct * tty) { struct hvcs_struct *hvcsd = tty->driver_data; unsigned long flags; - int temp_open_count; int irq; spin_lock_irqsave(&hvcsd->lock, flags); - /* Preserve this so that we know how many kref refs to put */ - temp_open_count = hvcsd->port.count; /* * Don't kref put inside the spinlock because the destruction @@ -1247,21 +1244,6 @@ static void hvcs_hangup(struct tty_struct * tty) spin_unlock_irqrestore(&hvcsd->lock, flags); free_irq(irq, hvcsd); - - /* - * We need to kref_put() for every open_count we have since the - * tty_hangup() function doesn't invoke a close per open connection on a - * non-console device. - */ - while(temp_open_count) { - --temp_open_count; - /* - * The final put will trigger destruction of the hvcs_struct. - * NOTE: If this hangup was signaled from user space then the - * final put will never happen. - */ - tty_port_put(&hvcsd->port); - } } /* |