lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200323125700.7512-1-hqjagain@gmail.com>
Date:   Mon, 23 Mar 2020 20:57:00 +0800
From:   Qiujun Huang <hqjagain@...il.com>
To:     tglx@...utronix.de, dan.carpenter@...cle.com,
        gregkh@...uxfoundation.org
Cc:     viro@...iv.linux.org.uk, deepa.kernel@...il.com,
        darrick.wong@...cle.com, linux-kernel@...r.kernel.org,
        syzkaller-bugs@...glegroups.com, anenbupt@...il.com,
        Qiujun Huang <hqjagain@...il.com>
Subject: [PATCH] minix: Fix NULL dereference in alloc_branch()

Need to check the return value of sb_getblk.

Reported-by: syzbot+4a88b2b9dc280f47baf4@...kaller.appspotmail.com
Signed-off-by: Qiujun Huang <hqjagain@...il.com>
---
 fs/minix/itree_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c
index 043c3fdbc8e7..6edb0f11e8a0 100644
--- a/fs/minix/itree_common.c
+++ b/fs/minix/itree_common.c
@@ -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;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ