From: Greg KH <gregkh@linuxfoundation.org>
To: Johan Hovold <johan@kernel.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-can@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] can: softing_cs: fix memleak on registration failure
Date: Wed, 22 Dec 2021 12:05:20 +0100 [thread overview]
Message-ID: <YcMGcBqkSaZzo7uq@kroah.com> (raw)
In-Reply-To: <20211222104843.6105-1-johan@kernel.org>
On Wed, Dec 22, 2021 at 11:48:43AM +0100, Johan Hovold wrote:
> In case device registration fails during probe, the driver state and the
> embedded platform device structure needs to be freed using
> platform_device_put() to properly free all resources (e.g. the device
> name).
>
> Fixes: 0a0b7a5f7a04 ("can: add driver for Softing card")
> Cc: stable@vger.kernel.org # 2.6.38
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/net/can/softing/softing_cs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/softing/softing_cs.c b/drivers/net/can/softing/softing_cs.c
> index 2e93ee792373..e5c939b63fa6 100644
> --- a/drivers/net/can/softing/softing_cs.c
> +++ b/drivers/net/can/softing/softing_cs.c
> @@ -293,7 +293,7 @@ static int softingcs_probe(struct pcmcia_device *pcmcia)
> return 0;
>
> platform_failed:
> - kfree(dev);
> + platform_device_put(pdev);
> mem_failed:
> pcmcia_bad:
> pcmcia_failed:
> --
> 2.32.0
>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
prev parent reply other threads:[~2021-12-22 11:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 10:48 [PATCH] can: softing_cs: fix memleak on registration failure Johan Hovold
2021-12-22 11:05 ` Greg KH [this message]
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=YcMGcBqkSaZzo7uq@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=johan@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wg@grandegger.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.