linux/fs/ntfs3
Jia-Ju Bai 97498cd610
fs: ntfs3: Fix possible null-pointer dereferences in mi_read()
In a previous commit 2681631c29 ("fs/ntfs3: Add null pointer check to
attr_load_runs_vcn"), ni can be NULL in attr_load_runs_vcn(), and thus it
should be checked before being used.

However, in the call stack of this commit, mft_ni in mi_read() is
aliased with ni in attr_load_runs_vcn(), and it is also used in
mi_read() at two places:

mi_read()
  rw_lock = &mft_ni->file.run_lock -> No check
  attr_load_runs_vcn(mft_ni, ...)
    ni (namely mft_ni) is checked in the previous commit
  attr_load_runs_vcn(..., &mft_ni->file.run) -> No check

Thus, to avoid possible null-pointer dereferences, the related checks
should be added.

These bugs are reported by a static analysis tool implemented by myself,
and they are found by extending a known bug fixed in the previous commit.
Thus, they could be theoretical bugs.

Signed-off-by: Jia-Ju Bai <baijiaju@buaa.edu.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
2023-07-03 00:21:23 +04:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
attrlist.c fs/ntfs3: Validate data run offset 2022-09-30 17:39:49 +03:00
bitfunc.c fs/ntfs3: Add ntfs_bitmap_weight_le function and refactoring 2022-11-14 19:50:42 +03:00
bitmap.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04: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: Fix sparse problems 2022-11-14 19:50:42 +03:00
file.c fs/ntfs3: Use wrapper i_blocksize() in ntfs_zero_range() 2023-07-03 00:21:21 +04:00
frecord.c fs/ntfs3: Enhance sanity check while generating attr_list 2023-07-03 00:21:21 +04:00
fslog.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
fsntfs.c fs/ntfs3: Print details about mount fails 2023-03-27 17:44:36 +04:00
index.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
inode.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
Kconfig fs: build the legacy direct I/O code conditionally 2023-01-26 10:30:56 -07:00
lznt.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
Makefile
namei.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
ntfs_fs.h fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
ntfs.h fs/ntfs3: Refactoring of various minor issues 2023-03-27 16:59:16 +04:00
record.c fs: ntfs3: Fix possible null-pointer dereferences in mi_read() 2023-07-03 00:21:23 +04:00
run.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
super.c fs/ntfs3: Fix root inode checking 2023-03-27 17:44:37 +04:00
upcase.c fs/ntfs3: Add option "nocase" 2022-09-30 17:39:47 +03:00
xattr.c fs/ntfs3: Return error for inconsistent extended attributes 2023-07-03 00:21:22 +04:00