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: <20220712030532.1312455-1-xu.xin16@zte.com.cn>
Date:   Tue, 12 Jul 2022 03:05:32 +0000
From:   xu xin <cgel.zte@...il.com>
To:     xu.xin16@....com.cn, anton@...era.com
Cc:     linux-ntfs-dev@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org, Songyi Zhang <zhang.songyi@....com.cn>,
        Yang Yang <yang.yang29@....com.cn>,
        Jiang Xuexin <jiang.xuexin@....com.cn>,
        Zhang wenya <zhang.wenya1@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: [PATCH v3] fs/ntfs: fix BUG_ON of ntfs_read_block()

As the bug description at
https://lore.kernel.org/lkml/20220623033635.973929-1-xu.xin16@zte.com.cn/
attckers can use this bug to crash the system.

So to avoid panic, remove the BUG_ON, and use ntfs_warning to output a
warning to the syslog and return ERR.

Cc: stable@...r.kernel.org
Cc: Songyi Zhang <zhang.songyi@....com.cn>
Cc: Yang Yang <yang.yang29@....com.cn>
Cc: Jiang Xuexin<jiang.xuexin@....com.cn>
Cc: Zhang wenya<zhang.wenya1@....com.cn>
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: xu xin <xu.xin16@....com.cn>
---

Changelog for v3:
- Use IS_ERR_OR_NULL to check runlist.rl in ntfs_read_block
- Modify ntfs error log.

Changelog for v2:
- Use ntfs_warning instead of WARN().
- Add the tag Cc: stable@...r.kernel.org.

---
 fs/ntfs/aops.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 5f4fb6ca6f2e..b9421552686a 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -183,7 +183,14 @@ static int ntfs_read_block(struct page *page)
 	vol = ni->vol;
 
 	/* $MFT/$DATA must have its complete runlist in memory at all times. */
-	BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni));
+	if (IS_ERR_OR_NULL(ni->runlist.rl) && !ni->mft_no && !NInoAttr(ni)) {
+		ntfs_error(vol->sb, "Runlist of $MFT/$DATA is not cached. "
+				    "$MFT is corrupt.");
+		unlock_page(page);
+		if (IS_ERR(ni->runlist.rl))
+			return PTR_ERR(ni->runlist.rl);
+		return -EFAULT;
+	}
 
 	blocksize = vol->sb->s_blocksize;
 	blocksize_bits = vol->sb->s_blocksize_bits;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ