All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix handle refcount leak in ext4_write_begin()
@ 2021-09-08  7:06 Chenyuan Mi
  2021-10-07 14:06 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Chenyuan Mi @ 2021-09-08  7:06 UTC (permalink / raw)
  Cc: yuanxzhang, Chenyuan Mi, Xiyu Yang, Xin Tan, Theodore Ts'o,
	Andreas Dilger, linux-ext4, linux-kernel

The reference counting issue happens when ret is zero,
the function forgets to decrease the refcount of handle
increased by ext4_journal_start().

Fix this issue by using ext4_journal_stop() to decrease
the refcount of handle.

Signed-off-by: Chenyuan Mi <cymi20@fudan.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
 fs/ext4/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d18852d6029c..90c57d8e3de1 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1249,6 +1249,7 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
 		put_page(page);
 		return ret;
 	}
+	ext4_journal_stop(handle);
 	*pagep = page;
 	return ret;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-07 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08  7:06 [PATCH] ext4: Fix handle refcount leak in ext4_write_begin() Chenyuan Mi
2021-10-07 14:06 ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.