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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241008202137.8577-1-niharchaithanya@gmail.com>
Date: Wed,  9 Oct 2024 01:51:38 +0530
From: Nihar Chaithanya <niharchaithanya@...il.com>
To: shaggy@...nel.org
Cc: jfs-discussion@...ts.sourceforge.net,
	skhan@...uxfoundation.org,
	linux-bcachefs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Nihar Chaithanya <niharchaithanya@...il.com>,
	syzbot+412dea214d8baa3f7483@...kaller.appspotmail.com
Subject: [PATCH] jfs: add a check to prevent array-index-out-of-bounds

When the value of lp is 1 at the end of the iteration in the for loop,
lp is modified in the next iteration to a negative value.
Add a check to prevent this condition.

Reported-by: syzbot+412dea214d8baa3f7483@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=412dea214d8baa3f7483
Tested-by: syzbot+412dea214d8baa3f7483@...kaller.appspotmail.com
Signed-off-by: Nihar Chaithanya <niharchaithanya@...il.com>
---
 fs/jfs/jfs_dmap.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 5713994328cb..3ebb2dfdd0b3 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -2911,6 +2911,12 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
 		 */
 		tp->dmt_stree[pp] = max;
 
+		/* check to prevent negative value of lp on the
+		 * next iteration.
+		 */
+		if (lp == 1)
+			break;
+
 		/* parent becomes leaf for next go-round.
 		 */
 		lp = pp;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ