summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-11-12 17:25:41 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 11:59:31 +0100
commit33519ccf9426c417b61bb57d777d843def7deecb (patch)
tree992ead72d56da951b3be52627d935e9f2e353ce5 /drivers
parent6723e58d6f4abb6b6dd37953b6d890d29146b612 (diff)
downloadlinux-rpi-33519ccf9426c417b61bb57d777d843def7deecb.tar.gz
linux-rpi-33519ccf9426c417b61bb57d777d843def7deecb.tar.bz2
linux-rpi-33519ccf9426c417b61bb57d777d843def7deecb.zip
pcmcia: cs: fix possible hung task and memory leak pccardd()
[ Upstream commit e3ea1b4847e49234e691c0d66bf030bd65bb7f2b ] 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> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pcmcia/cs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 5658745c398f..b33be1e63c98 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);