From: Dominik Brodowski <linux@dominikbrodowski.net>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pcmcia: cs: fix possible hung task and memory leak pccardd()
Date: Mon, 4 Sep 2023 21:59:48 +0200 [thread overview]
Message-ID: <ZPY3NGjRVECc2AOZ@light.dominikbrodowski.net> (raw)
In-Reply-To: <20221112092541.3605038-1-yangyingliang@huawei.com>
Am Sat, Nov 12, 2022 at 05:25:41PM +0800 schrieb Yang Yingliang:
> If device_register() returns error in pccardd(), it leads two issues:
>
> 1. The socket_released has never been completed, it will block
> pcmcia_unregister_socket(), because of waiting for completion
> of socket_released.
> 2. The device name allocated by dev_set_name() is leaked.
>
> Fix this two issues by calling put_device() when device_register() fails.
> socket_released can be completed in pcmcia_release_socket(), the name can
> be freed in kobject_cleanup().
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/pcmcia/cs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
> index f70197154a36..820cce7c8b40 100644
> --- a/drivers/pcmcia/cs.c
> +++ b/drivers/pcmcia/cs.c
> @@ -605,6 +605,7 @@ static int pccardd(void *__skt)
> dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
> skt->thread = NULL;
> complete(&skt->thread_done);
> + put_device(&skt->dev);
> return 0;
> }
> ret = pccard_sysfs_add_socket(&skt->dev);
> --
> 2.25.1
>
Applied to pcmcia-next, thanks!
Dominik
prev parent reply other threads:[~2023-09-04 20:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 9:25 Yang Yingliang
2023-09-04 19:59 ` Dominik Brodowski [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=ZPY3NGjRVECc2AOZ@light.dominikbrodowski.net \
--to=linux@dominikbrodowski.net \
--cc=linux-kernel@vger.kernel.org \
--cc=yangyingliang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®