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 4.19-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-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ea2b62f305893992156a798f665847e0663c9f41 Mon Sep 17 00:00:00 2001 From: Prince Kumar Maurya <princekumarmaurya06@xxxxxxxxx> Date: Tue, 30 May 2023 18:31:41 -0700 Subject: fs/sysv: Null check to prevent null-ptr-deref bug From: Prince Kumar Maurya <princekumarmaurya06@xxxxxxxxx> commit ea2b62f305893992156a798f665847e0663c9f41 upstream. 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: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/sysv/itree.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c @@ -145,6 +145,10 @@ static int alloc_branch(struct inode *in */ 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; Patches currently in stable-queue which might be from princekumarmaurya06@xxxxxxxxx are queue-4.19/fs-sysv-null-check-to-prevent-null-ptr-deref-bug.patch