1
0
Fork 0
alistair23-linux/fs/configfs
Xiyu Yang dcec6678c3 configfs: fix config_item refcnt leak in configfs_rmdir()
[ Upstream commit 8aebfffacf ]

configfs_rmdir() invokes configfs_get_config_item(), which returns a
reference of the specified config_item object to "parent_item" with
increased refcnt.

When configfs_rmdir() returns, local variable "parent_item" becomes
invalid, so the refcount should be decreased to keep refcount balanced.

The reference counting issue happens in one exception handling path of
configfs_rmdir(). When down_write_killable() fails, the function forgets
to decrease the refcnt increased by configfs_get_config_item(), causing
a refcnt leak.

Fix this issue by calling config_item_put() when down_write_killable()
fails.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-05-27 17:46:30 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
configfs_internal.h configfs: calculate the symlink target only once 2019-09-11 12:46:14 +02:00
dir.c configfs: fix config_item refcnt leak in configfs_rmdir() 2020-05-27 17:46:30 +02:00
file.c configfs: provide exclusion between IO and removals 2019-09-04 22:33:51 +02:00
inode.c utimes: Clamp the timestamps in notify_change() 2020-02-11 04:35:12 -08:00
item.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 145 2019-05-30 11:25:18 -07:00
mount.c configfs: calculate the symlink target only once 2019-09-11 12:46:14 +02:00
symlink.c configfs: calculate the depth of parent item 2019-11-06 18:36:01 +01:00