[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191122190208.GA248138@dtor-ws>
Date: Fri, 22 Nov 2019 11:02:08 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Navid Emamdoost <navid.emamdoost@...il.com>
Cc: Kate Stewart <kstewart@...uxfoundation.org>,
Richard Fontana <rfontana@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Allison Randal <allison@...utok.net>,
Thomas Gleixner <tglx@...utronix.de>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
emamd001@....edu
Subject: Re: [PATCH] Input: Fix memory leak in psxpad_spi_probe
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@...il.com>
This is fixed in the current version of the driver, but you can send it
to stable@...kernel.orf with my
Acked-by: Dmitry Torokhov <dmitry.torokhov@...il.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
Powered by blists - more mailing lists