Xiyu Yang 3bbd0ef260 ext4: fix buffer_head refcnt leak when ext4_iget() fails
ext4_orphan_get() invokes ext4_read_inode_bitmap(), which returns a
reference of the specified buffer_head object to "bitmap_bh" with
increased refcnt.

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

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

Fix this issue by calling brelse() when ext4_iget() fails.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/1587618568-13418-1-git-send-email-xiyuyang19@fudan.edu.cn
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-06-03 23:16:49 -04:00
..
2020-03-27 09:29:56 +00:00
2019-09-19 09:42:37 -07:00
2020-03-31 12:58:36 -07:00
2020-02-17 21:08:37 -08:00
2019-11-11 09:21:59 -05:00
2020-04-07 13:48:26 -07:00
2020-02-13 09:16:07 +01:00
2019-09-19 09:42:37 -07:00
2020-02-05 05:28:20 +00:00
\n
2020-01-30 15:37:41 -08:00
2020-04-10 15:36:22 -07:00
2019-09-19 09:42:37 -07:00
2020-01-14 13:28:28 -08:00
2020-04-21 09:51:10 -06:00
2020-04-24 12:44:19 -07:00
2019-08-07 21:51:47 -04:00
2020-02-07 14:48:35 -05:00
2020-02-07 14:48:35 -05:00
2020-03-06 11:06:15 +01:00
2020-03-05 21:00:40 -05:00
2020-03-05 21:00:40 -05:00
2020-04-06 10:38:59 -04:00
2020-03-12 17:33:11 -07:00
2020-03-02 14:04:31 -07:00
2019-12-08 14:37:36 +01:00
2020-04-28 14:37:40 -07:00