]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ext4: fix potential uninitialized access to retval in kmmpd
authorYe Bin <yebin10@huawei.com>
Tue, 13 Jul 2021 02:27:28 +0000 (10:27 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Jul 2021 11:31:29 +0000 (07:31 -0400)
if (!ext4_has_feature_mmp(sb)) then retval can be unitialized before
we jump to the wait_to_exit label.

Fixes: 61bb4a1c417e ("ext4: fix possible UAF when remounting r/o a mmp-protected file system")
Signed-off-by: Ye Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20210713022728.2533770-1-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mmp.c

index bc364c119af6ac00bcfedcec131af0178ecfa428..cebea4270817e7c0218cc2f3034449ce0d0ef342 100644 (file)
@@ -138,7 +138,7 @@ static int kmmpd(void *data)
        unsigned mmp_check_interval;
        unsigned long last_update_time;
        unsigned long diff;
-       int retval;
+       int retval = 0;
 
        mmp_block = le64_to_cpu(es->s_mmp_block);
        mmp = (struct mmp_struct *)(bh->b_data);