linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Navid Emamdoost <navid.emamdoost@gmail.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>,
	Richard Fontana <rfontana@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Allison Randal <allison@lohutok.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	emamd001@umn.edu
Subject: Re: [PATCH] Input: Fix memory leak in psxpad_spi_probe
Date: Fri, 22 Nov 2019 11:02:08 -0800	[thread overview]
Message-ID: <20191122190208.GA248138@dtor-ws> (raw)
In-Reply-To: <20191121200115.24846-1-navid.emamdoost@gmail.com>

Hi Navid,

On Thu, Nov 21, 2019 at 02:01:11PM -0600, Navid Emamdoost wrote:
> In the implementation of psxpad_spi_probe() the allocated memory for
> pdev is leaked if psxpad_spi_init_ff() or input_register_polled_device()
> fail. The solution is using device managed allocation, like the one used
> for pad. Perform the allocation using
> devm_input_allocate_polled_device().
> 
> Fixes: 8be193c7b1f4 ("Input: add support for PlayStation 1/2 joypads connected via SPI")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

This is fixed in the current version of the driver, but you can send it
to stable@gerkernel.orf with my

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  drivers/input/joystick/psxpad-spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/joystick/psxpad-spi.c b/drivers/input/joystick/psxpad-spi.c
> index 7eee1b0e360f..99a6052500ca 100644
> --- a/drivers/input/joystick/psxpad-spi.c
> +++ b/drivers/input/joystick/psxpad-spi.c
> @@ -292,7 +292,7 @@ static int psxpad_spi_probe(struct spi_device *spi)
>  	if (!pad)
>  		return -ENOMEM;
>  
> -	pdev = input_allocate_polled_device();
> +	pdev = devm_input_allocate_polled_device(&spi->dev);
>  	if (!pdev) {
>  		dev_err(&spi->dev, "failed to allocate input device\n");
>  		return -ENOMEM;
> -- 
> 2.17.1
> 

-- 
Dmitry

  reply	other threads:[~2019-11-22 19:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 20:01 [PATCH] Input: Fix memory leak in psxpad_spi_probe Navid Emamdoost
2019-11-22 19:02 ` Dmitry Torokhov [this message]
2019-11-26  9:34   ` Greg Kroah-Hartman
2019-12-07 20:44     ` Dmitry Torokhov

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=20191122190208.GA248138@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=allison@lohutok.net \
    --cc=emamd001@umn.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    --cc=rfontana@redhat.com \
    --cc=tglx@linutronix.de \
    /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).