linux/fs/ntfs3
Jia-Ju Bai 20f9bfc664 fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()
[ Upstream commit ec275bf969 ]

In a previous commit c1006bd13146, ni->mi.mrec in ni_write_inode()
could be NULL, and thus a NULL check is added for this variable.

However, in the same call stack, ni->mi.mrec can be also dereferenced
in ni_clear():

ntfs_evict_inode(inode)
  ni_write_inode(inode, ...)
    ni = ntfs_i(inode);
    is_rec_inuse(ni->mi.mrec) -> Add a NULL check by previous commit
  ni_clear(ntfs_i(inode))
    is_rec_inuse(ni->mi.mrec) -> No check

Thus, a possible null-pointer dereference may exist in ni_clear().
To fix it, a NULL check is added in this function.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-24 17:36:47 +01:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Fix attr_punch_hole() null pointer derenference 2023-01-24 07:22:48 +01:00
attrlist.c fs/ntfs3: Validate data run offset 2023-01-12 11:58:43 +01:00
bitfunc.c fs/ntfs3: Remove a useless shadowing variable 2021-09-23 19:05:46 +03:00
bitmap.c fs/ntfs3: Refactoring of various minor issues 2023-05-17 11:50:26 +02:00
debug.h fs/ntfs3. Add forward declarations for structs to debug.h 2021-09-13 19:41:43 +03:00
dir.c fs/ntfs3: Rework ntfs_utf16_to_nls 2021-10-11 19:28:04 +03:00
file.c fs/ntfs3: don't hold ni_lock when calling truncate_setsize() 2023-01-12 11:59:15 +01:00
frecord.c fs/ntfs3: Fix a possible null-pointer dereference in ni_clear() 2023-05-24 17:36:47 +01:00
fslog.c fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de() 2023-05-11 23:00:36 +09:00
fsntfs.c fs/ntfs3: Fix NULL pointer dereference in 'ni_write_inode' 2023-05-24 17:36:47 +01:00
index.c fs/ntfs3: Add length check in indx_get_root 2023-05-24 17:36:47 +01:00
inode.c fs/ntfs3: Validate MFT flags before replaying logs 2023-05-24 17:36:47 +01:00
Kconfig
lznt.c fs/ntfs3: Remove tabs before spaces from comment 2021-09-16 17:01:36 +03:00
Makefile
namei.c fs/ntfs3: Refactoring of various minor issues 2023-05-17 11:50:26 +02:00
ntfs_fs.h fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de() 2023-05-11 23:00:36 +09:00
ntfs.h fs/ntfs3: Refactoring of various minor issues 2023-05-17 11:50:26 +02:00
record.c fs/ntfs3: Enhance the attribute size check 2023-05-24 17:36:47 +01:00
run.c fs/ntfs3: Remove unneeded header files from c files 2021-09-13 19:41:46 +03:00
super.c fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_fill_super() 2023-01-12 11:58:45 +01:00
upcase.c fs/ntfs3: Change right headers to upcase.c 2021-09-13 19:41:45 +03:00
xattr.c fs/ntfs3: Harden against integer overflows 2022-12-31 13:14:33 +01:00