]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xfs: ensure logflagsp is initialized in xfs_bmap_del_extent_real
authorJiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Wed, 27 Mar 2024 00:12:30 +0000 (17:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:48 +0000 (15:28 +0200)
commit264e3509590cd8eac1f1e96b99d68904ea7d3056
treeea071096828343f70b27283621ea62cefdd46588
parent8a4566795552db92fc39b6983173fdfe09e102e0
xfs: ensure logflagsp is initialized in xfs_bmap_del_extent_real

commit e6af9c98cbf0164a619d95572136bfb54d482dd6 upstream.

In the case of returning -ENOSPC, ensure logflagsp is initialized by 0.
Otherwise the caller __xfs_bunmapi will set uninitialized illegal
tmp_logflags value into xfs log, which might cause unpredictable error
in the log recovery procedure.

Also, remove the flags variable and set the *logflagsp directly, so that
the code should be more robust in the long run.

Fixes: 1b24b633aafe ("xfs: move some more code into xfs_bmap_del_extent_real")
Signed-off-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/libxfs/xfs_bmap.c