]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libsupport: avoid possible null dereference in quota_set_sb_inum()
authorzhanchengbin <zhanchengbin1@huawei.com>
Fri, 31 Dec 2021 07:42:17 +0000 (15:42 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 May 2022 00:56:42 +0000 (20:56 -0400)
If the quota type is invalid, quota_sb_inump will return NULL; this
should not cause the program to crash.

Link: https://lore.kernel.org/r/ee0b034c-71f3-63b7-a8de-d8e7760b9545@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/support/mkquota.c

index 5de7c48d6dd0fe93641992657a3852be750a3b47..c89f895907f1d5d47222a7c72d24d21f40aa55b1 100644 (file)
@@ -99,6 +99,8 @@ void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, enum quota_type qtype)
 
        log_debug("setting quota ino in superblock: ino=%u, type=%d", ino,
                 qtype);
+       if (inump == NULL)
+               return;
        *inump = ino;
        ext2fs_mark_super_dirty(fs);
 }