Commit ea2b62f3 authored by Prince Kumar Maurya's avatar Prince Kumar Maurya Committed by Christian Brauner

fs/sysv: Null check to prevent null-ptr-deref bug

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@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=aad58150cbc64ba41bdcSigned-off-by: default avatarPrince Kumar Maurya <princekumarmaurya06@gmail.com>
Message-Id: <20230531013141.19487-1-princekumarmaurya06@gmail.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent b7a9a503
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment