]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pcmcia: ds: fix refcount leak in pcmcia_device_add()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 12 Nov 2022 09:29:23 +0000 (17:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 09:30:14 +0000 (10:30 +0100)
commit1502edd4a014fa00c97b585c56034576baa1b619
tree434baae78f3a2c86e25a22ceb6a8b38f5925e156
parent58d6fb6a933c84eb010a7364b301ec95318bfc9c
pcmcia: ds: fix refcount leak in pcmcia_device_add()

[ Upstream commit 402ab979b29126068e0b596b641422ff7490214c ]

As the comment of device_register() says, it should use put_device()
to give up the reference in the error path. Then, insofar resources
will be freed in pcmcia_release_dev(), the error path is no longer
needed. In particular, this means that the (previously missing) dropping
of the reference to &p_dev->function_config->ref is now handled by
pcmcia_release_dev().

Fixes: 360b65b95bae ("[PATCH] pcmcia: make config_t independent, add reference counting")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
[linux@dominikbrodowski.net: simplification, commit message rewrite]
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pcmcia/ds.c