Patch "fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-ntfs3-fix-a-possible-null-pointer-dereference-in-.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f8f15d8d060ea5d23f22b377ab438cdeb846ed04
Author: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>
Date:   Wed Jan 11 16:59:43 2023 +0800

    fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()
    
    [ Upstream commit ec275bf9693d19cc0fdce8436f4c425ced86f6e7 ]
    
    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@xxxxxxxxx>
    Reported-by: TOTE Robot <oslab@xxxxxxxxxxxxxxx>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index bb7e33c240737..1f0e230ec9e2c 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -102,7 +102,7 @@ void ni_clear(struct ntfs_inode *ni)
 {
 	struct rb_node *node;
 
-	if (!ni->vfs_inode.i_nlink && is_rec_inuse(ni->mi.mrec))
+	if (!ni->vfs_inode.i_nlink && ni->mi.mrec && is_rec_inuse(ni->mi.mrec))
 		ni_delete_all(ni);
 
 	al_destroy(ni);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux