]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: ensure logflagsp is initialized in xfs_bmap_del_extent_real
authorJiachen Zhang <zhangjiachen.jaycee@bytedance.com>
Mon, 15 Apr 2024 23:07:35 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:24 +0000 (14:06 -0700)
commitaedfcddbb547963db5f5dafc04f9197e62cfb0a1
treeb2d557f07f2413c5cf9aefa6aee9f4fcf970cb63
parent63644c545a6628fef0dd4f53d88dd62e38d5db6b
xfs: ensure logflagsp is initialized in xfs_bmap_del_extent_real

Source kernel commit: e6af9c98cbf0164a619d95572136bfb54d482dd6

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>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
libxfs/xfs_bmap.c