[lkml]   [2021]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] tty: nozomi: Fix a resource leak in an error handling function
A 'request_irq()' call is not balanced by a corresponding 'free_irq()' in
the error handling path, as already done in the remove function.

Add it.

Fixes: 9842c38e9176 ("kfifo: fix warn_unused_result")
Signed-off-by: Christophe JAILLET <>
I also wonder if the loop above is correct. The 'i < MAX_PORT' looks really
spurious to me.
'tty_port_destroy' can be called twice for the same entry (once before
branching in the error handling path, and once in here) and
'tty_unregister_device'/'tty_port_destroy' will be called on entries
that have not been 'tty_port_init'ed or 'tty_port_register_device'd.
I don't know if it may be an issue.
drivers/tty/nozomi.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index 9a2d78ace49b..b270e137ef9b 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1420,6 +1420,7 @@ static int nozomi_card_init(struct pci_dev *pdev,
tty_unregister_device(ntty_driver, dc->index_start + i);
+ free_irq(pdev->irq, dc);
for (i = 0; i < MAX_PORT; i++)
 \ /
  Last update: 2021-05-09 19:23    [W:0.113 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site