Patch "fs/sysv: Null check to prevent null-ptr-deref bug" has been added to the 6.4-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/sysv: Null check to prevent null-ptr-deref bug

to the 6.4-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-sysv-null-check-to-prevent-null-ptr-deref-bug.patch
and it can be found in the queue-6.4 subdirectory.

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



commit abf4a5eb10d8347e712f0985d965ff89d05a571f
Author: Prince Kumar Maurya <princekumarmaurya06@xxxxxxxxx>
Date:   Tue May 30 18:31:41 2023 -0700

    fs/sysv: Null check to prevent null-ptr-deref bug
    
    [ Upstream commit ea2b62f305893992156a798f665847e0663c9f41 ]
    
    sb_getblk(inode->i_sb, parent) return a null ptr and taking lock on
    that leads to the null-ptr-deref bug.
    
    Reported-by: syzbot+aad58150cbc64ba41bdc@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://syzkaller.appspot.com/bug?extid=aad58150cbc64ba41bdc
    Signed-off-by: Prince Kumar Maurya <princekumarmaurya06@xxxxxxxxx>
    Message-Id: <20230531013141.19487-1-princekumarmaurya06@xxxxxxxxx>
    Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index b22764fe669c8..58d7f43a13712 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -145,6 +145,10 @@ static int alloc_branch(struct inode *inode,
 		 */
 		parent = block_to_cpu(SYSV_SB(inode->i_sb), branch[n-1].key);
 		bh = sb_getblk(inode->i_sb, parent);
+		if (!bh) {
+			sysv_free_block(inode->i_sb, branch[n].key);
+			break;
+		}
 		lock_buffer(bh);
 		memset(bh->b_data, 0, blocksize);
 		branch[n].bh = bh;



[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