[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241025152459.485-1-zoo868e@gmail.com>
Date: Fri, 25 Oct 2024 23:24:59 +0800
From: Matt Jan <zoo868e@...il.com>
To: Dave Kleikamp <shaggy@...nel.org>,
jfs-discussion@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Cc: Matt Jan <zoo868e@...il.com>,
syzbot+9e90a1c5eedb9dc4c6cc@...kaller.appspotmail.com
Subject: [PATCH v2] jfs: UBSAN: shift-out-of-bounds in dbFindBits
The starting bit number of free bits should not be >= 32 as it is
0-indexed.Assert that the number of bits is < 32, or if it is 32, the
input word must be 0.
#syz test
Reported-by: syzbot+9e90a1c5eedb9dc4c6cc@...kaller.appspotmail.com
Signed-off-by: Matt Jan <zoo868e@...il.com>
---
Changes in v2: Test if the patch resolve the issue through syzbot and
reference the reporter.
fs/jfs/jfs_dmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 974ecf5e0d95..b9eccf8900eb 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -3015,7 +3015,7 @@ static int dbFindBits(u32 word, int l2nb)
/* get the number of bits.
*/
nb = 1 << l2nb;
- assert(nb <= DBWORD);
+ assert(nb < DBWORD || (nb == DBWORD && !word));
/* complement the word so we can use a mask (i.e. 0s represent
* free bits) and compute the mask.
--
2.25.1
Powered by blists - more mailing lists