deepin-kernel/fs/ocfs2
Murad Masimov 2bacedbc0e 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: 2205363dce ("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>
(cherry picked from commit 681a35b1dcf19222f36b53f1ad7e7ce5e5ed0a52)
2025-06-20 14:39:41 +08:00
..
cluster ocfs2: cluster: fix potential deadlock on &o2net_debug_lock 2023-08-18 10:18:59 -07:00
dlm ocfs2/dlm: use bitmap API instead of hand-writing it 2022-11-18 13:55:06 -08:00
dlmfs ocfs2: convert to new timestamp accessors 2024-12-10 20:29:03 +08:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile
acl.c ocfs2: convert to new timestamp accessors 2024-12-10 20:29:03 +08:00
acl.h fs: port ->set_acl() to pass mnt_idmap 2023-01-19 09:24:27 +01:00
alloc.c ocfs2: validate l_tree_depth to avoid out-of-bounds access 2025-04-14 15:49:22 +08:00
alloc.h
aops.c ocfs2: fix uninit-value in ocfs2_get_block() 2024-12-10 20:42:30 +08:00
aops.h ocfs2: fix uninitialized value in ocfs2_file_read_iter() 2024-12-10 20:44:47 +08:00
blockcheck.c
blockcheck.h
buffer_head_io.c ocfs2: fix possible null-ptr-deref in ocfs2_set_buffer_uptodate 2024-12-10 20:42:31 +08:00
buffer_head_io.h
dcache.c
dcache.h
dir.c ocfs2: check dir i_size in ocfs2_find_entry 2025-02-18 11:53:09 +08:00
dir.h
dlmglue.c ocfs2: update seq_file index in ocfs2_dlm_seq_next 2024-12-16 00:22:41 +08:00
dlmglue.h
export.c
export.h
extent_map.c ocfs2: fix deadlock in ocfs2_get_system_file_inode 2025-01-24 10:13:49 +08:00
extent_map.h
file.c ocfs2: fix uninitialized value in ocfs2_file_read_iter() 2024-12-10 20:44:47 +08:00
file.h fs: port ->permission() to pass mnt_idmap 2023-01-19 09:24:28 +01:00
filecheck.c
filecheck.h
heartbeat.c
heartbeat.h
inode.c ocfs2: convert to new timestamp accessors 2024-12-10 20:29:03 +08:00
inode.h quota: Properly annotate i_dquot arrays with __rcu 2024-03-26 18:19:46 -04:00
ioctl.c ocfs2: reduce ioctl stack usage 2023-04-21 14:54:34 -07:00
ioctl.h fs: port ->fileattr_set() to pass mnt_idmap 2023-01-19 09:24:27 +01:00
journal.c ocfs2: stop quota recovery before disabling quotas 2025-05-23 23:47:13 +08:00
journal.h ocfs2: stop quota recovery before disabling quotas 2025-05-23 23:47:13 +08:00
localalloc.c ocfs2: Revert "ocfs2: fix the la space leak when unmounting an ocfs2 volume" 2024-12-16 00:22:41 +08:00
localalloc.h
locks.c filelock: move file locking definitions to separate header file 2023-01-11 06:52:32 -05:00
locks.h
mmap.c
mmap.h
move_extents.c ocfs2: convert to new timestamp accessors 2024-12-10 20:29:03 +08:00
move_extents.h
namei.c ocfs2: free inode when ocfs2_get_init_inode() fails 2024-12-16 00:22:41 +08:00
namei.h
ocfs1_fs_compat.h
ocfs2.h ocfs2: stop quota recovery before disabling quotas 2025-05-23 23:47:13 +08:00
ocfs2_fs.h ocfs2: replace zero-length arrays with DECLARE_FLEX_ARRAY() helper 2022-10-03 14:21:42 -07:00
ocfs2_ioctl.h
ocfs2_lockid.h
ocfs2_lockingver.h
ocfs2_trace.h ocfs2: fix DIO failure due to insufficient transaction credits 2024-12-10 20:38:53 +08:00
quota.h
quota_global.c ocfs2: mark dquot as inactive if failed to start trans while releasing dquot 2025-02-10 01:59:56 +08:00
quota_local.c ocfs2: fix possible memory leak in ocfs2_finish_quota_recovery 2025-06-20 14:39:41 +08:00
refcounttree.c ocfs2: reserve space for inline xattr before attaching reflink tree 2024-12-10 20:42:30 +08:00
refcounttree.h
reservations.c
reservations.h
resize.c ocfs2: uncache inode which has failed entering the group 2024-12-10 20:43:55 +08:00
resize.h
slot_map.c
slot_map.h
stack_o2cb.c ocfs2: use bitmap API in fill_node_map 2022-11-18 13:55:06 -08:00
stack_user.c fs: dlm: fix F_CANCELLK to cancel pending request 2023-07-20 17:25:04 -05:00
stackglue.c ocfs2: fix memory leak in ocfs2_stack_glue_init() 2022-11-18 13:55:09 -08:00
stackglue.h
suballoc.c
suballoc.h fs/ocfs2/suballoc.h: fix spelling typo in comment 2022-10-03 14:21:42 -07:00
super.c ocfs2: stop quota recovery before disabling quotas 2025-05-23 23:47:13 +08:00
super.h
symlink.c ocfs2: handle a symlink read error correctly 2025-02-18 11:53:09 +08:00
symlink.h
sysfile.c
sysfile.h
uptodate.c
uptodate.h
xattr.c ocfs2: remove entry once instead of null-ptr-dereference in ocfs2_xa_remove() 2024-12-10 20:43:46 +08:00
xattr.h