minix: Fix NULL dereference in alloc_branch()
PATCH 1/1 minix: Fix NULL dereference in alloc_branch()
Need to check the return value of sb_getblk.
Reported-by [email protected]
Signed-off-by Qiujun Huang <[email protected]>
--- fs/minix/itree_common.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/minix/itree_common.c +4 -0
@@ -85,6 +85,10 @@ static int alloc_branch(struct inode *inode,break ; branch[n].key =cpu_to_block (nr); bh =sb_getblk (inode->i_sb, parent); +if (!bh) { +minix_free_block (inode,block_to_cpu (branch[n].key)); +break ; + }lock_buffer (bh);memset (bh->b_data,0 , bh->b_size); branch[n].bh = bh;
Signature · 1 line
2.17.1