kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	akpm@linux-foundation.org, stefani@seibold.net,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] tty: nozomi: Fix a resource leak in an error handling function
Date: Mon, 10 May 2021 09:35:13 +0300	[thread overview]
Message-ID: <20210510063513.GQ1955@kadam> (raw)
In-Reply-To: <4f0d2b3038e82f081d370ccb0cade3ad88463fe7.1620580838.git.christophe.jaillet@wanadoo.fr>

On Sun, May 09, 2021 at 07:22:33PM +0200, Christophe JAILLET wrote:
> 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 <christophe.jaillet@wanadoo.fr>
> ---
> 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.


Calling tty_port_destroy() twice is fine, but I think calling
tty_unregister_device() for unregistered devices will lead to a NULL
dereference in cdev_del().

regards,
dan carpenter


  reply	other threads:[~2021-05-10  6:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09 17:22 [PATCH] tty: nozomi: Fix a resource leak in an error handling function Christophe JAILLET
2021-05-10  6:35 ` Dan Carpenter [this message]
2021-05-10  9:51 ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210510063513.GQ1955@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefani@seibold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).