Xiyu Yang 1957df4975 configfs: fix config_item refcnt leak in configfs_rmdir()
[ Upstream commit 8aebfffacfa379ba400da573a5bf9e49634e38cb ]

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:41:45 +02:00
..
2020-01-29 10:24:34 +01:00
2016-10-15 12:09:13 -07:00
2019-08-06 18:29:38 +02:00
2019-12-21 10:41:21 +01:00
2020-01-23 08:19:37 +01:00
2017-11-30 08:39:04 +00:00
2019-03-13 14:04:52 -07:00
2018-12-21 14:11:31 +01:00
2016-09-27 21:20:53 -04:00
2020-04-02 17:20:27 +02:00
2018-02-17 13:21:15 +01:00
2017-06-14 15:06:01 +02:00