linux-stable/fs/configfs
Xiyu Yang 5765f42d9f 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 16:42:56 +02:00
..
configfs_internal.h configfs: new object reprsenting tree fragments 2019-11-12 19:18:17 +01:00
dir.c configfs: fix config_item refcnt leak in configfs_rmdir() 2020-05-27 16:42:56 +02:00
file.c configfs: provide exclusion between IO and removals 2019-11-12 19:18:17 +01:00
inode.c fs: Replace current_fs_time() with current_time() 2016-09-27 21:06:22 -04:00
item.c configfs: Introduce config_item_get_unless_zero() 2017-06-12 13:20:20 +02:00
Kconfig configfs: change depends -> select SYSFS 2011-01-16 21:22:29 +00:00
Makefile
mount.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
symlink.c configfs: fix a deadlock in configfs_symlink() 2019-11-12 19:18:18 +01:00