[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210908070640.7135-1-cymi20@fudan.edu.cn>
Date: Wed, 8 Sep 2021 15:06:40 +0800
From: Chenyuan Mi <cymi20@...an.edu.cn>
To: unlisted-recipients:; (no To-header on input)
Cc: yuanxzhang@...an.edu.cn, Chenyuan Mi <cymi20@...an.edu.cn>,
Xiyu Yang <xiyuyang19@...an.edu.cn>,
Xin Tan <tanxin.ctf@...il.com>,
"Theodore Ts'o" <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ext4: Fix handle refcount leak in ext4_write_begin()
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@...an.edu.cn>
Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@...il.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
Powered by blists - more mailing lists