]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
mmp: fix wrong comparison in ext2fs_mmp_stop
authorlihaoxiang (F) <lihaoxiang9@huawei.com>
Tue, 29 Nov 2022 07:02:39 +0000 (15:02 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 26 Jan 2023 16:00:51 +0000 (11:00 -0500)
commitffa6de1e3da4216a2ed6ec2890e16b22dc2ca40f
tree7c9d38860ea7252f05eee5155c926f6b63f25915
parent206541974a2356208480a5da9df676569cbb0793
mmp: fix wrong comparison in ext2fs_mmp_stop

In our knowledge, ext2fs_mmp_stop use to process the rest of work
when mmp will finish.  Critically, it must check if the mmp block is
not changed. But there exist an error in comparing the mmp and mmp_cmp.

Look to ext2fs_mmp_read, the assignment of mmp_cmp retrieve from the
superblock of disk and it copy to mmp_buf if mmp_buf is not none
and not equal to mmp_cmp in the meanwhile. However, ext2fs_mmp_stop
pass the no NULL pointer fs->mmp_buf which has possed the mmp info to
ext2fs_mmp_read. Consequently, ext2fs_mmp_read override fs->mmp_buf
by fs->mmp_cmp so that loss the meaning of comparing themselves
after that and worse yet, couldn't judge whether the struct of mmp
has changed.

In fact, we only need to modify the parameter to NULL pointer for
solving this problem.

Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/mmp.c