mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
f2fs: fix dentry folio leak in find_in_level
find_in_level() gets a dentry folio with f2fs_find_data_folio() before
calling find_in_block(). If find_in_block() returns an error, the
function stores the error in res_folio and breaks out of the loop without
dropping the dentry folio.
This leaks the folio reference on the find_in_block() error path. Drop
the dentry folio before returning the error to the caller.
Fixes: 7ad08a58bf ("f2fs: Handle casefolding with Encryption")
Cc: stable@vger.kernel.org
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Guanghui Yang <3497809730@qq.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
0dab71381f
commit
cca7d3e30b
|
|
@ -320,6 +320,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
|
|||
|
||||
de = find_in_block(dir, dentry_folio, fname, &max_slots, use_hash);
|
||||
if (IS_ERR(de)) {
|
||||
f2fs_folio_put(dentry_folio, false);
|
||||
*res_folio = ERR_CAST(de);
|
||||
de = NULL;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user