summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMurad Masimov <m.masimov@mt-integration.ru>2025-04-02 09:56:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-19 15:28:23 +0200
commit681a35b1dcf19222f36b53f1ad7e7ce5e5ed0a52 (patch)
treea8cdeb83fb6758f3115b08fc05195fba61c4ca9b /fs
parent4f99357dadbf9c979ad737156ad4c37fadf7c56b (diff)
downloadlinux-681a35b1dcf19222f36b53f1ad7e7ce5e5ed0a52.tar.gz
linux-681a35b1dcf19222f36b53f1ad7e7ce5e5ed0a52.tar.bz2
linux-681a35b1dcf19222f36b53f1ad7e7ce5e5ed0a52.zip
ocfs2: fix possible memory leak in ocfs2_finish_quota_recovery
[ Upstream commit cdc3ed3035d0fe934aa1d9b78ce256752fd3bb7d ] If ocfs2_finish_quota_recovery() exits due to an error before passing all rc_list elements to ocfs2_recover_local_quota_file() then it can lead to a memory leak as rc_list may still contain elements that have to be freed. Release all memory allocated by ocfs2_add_recovery_chunk() using ocfs2_free_quota_recovery() instead of kfree(). Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Link: https://lkml.kernel.org/r/20250402065628.706359-2-m.masimov@mt-integration.ru Fixes: 2205363dce74 ("ocfs2: Implement quota recovery") Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Jun Piao <piaojun@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/quota_local.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 0ca8975a1df4..c7bda48b5fb2 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -671,7 +671,7 @@ out_put:
break;
}
out:
- kfree(rec);
+ ocfs2_free_quota_recovery(rec);
return status;
}