[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240601025607.22180-1-aha310510@gmail.com>
Date: Sat, 1 Jun 2024 11:56:07 +0900
From: Jeongjun Park <aha310510@...il.com>
To: darklight2357@...il.com
Cc: aha310510@...il.com,
linux-kernel@...r.kernel.org,
syzbot+13e8cd4926977f8337b6@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [jfs?] UBSAN: shift-out-of-bounds in extAlloc (2)
Hi,
Thanks to the points you pointed out, I was able to confirm that there
was a rudimentary mistake in my patch. And as you suggested, I think
it would be a good idea to handle the two situations separately.
However, if you only check when there is a value of sizeof(s64) * 8 or
more in bmp->db_maxfreebud, the value will change to a negative number
when bmp->db_maxfreebud is 63 because max is an s64 data type.
Therefore, I think it is right to slightly modify the conditions.
Regards.
---
fs/jfs/jfs_extent.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 63d21822d309..3d1273d35b13 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -316,6 +316,9 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
if (bmp->db_maxfreebud == -1)
return -ENOSPC;
+ if (bmp->db_maxfreebud >= sizeof(s64) * 8 - 1)
+ return -EINVAL;
+
max = (s64) 1 << bmp->db_maxfreebud;
if (*nblocks >= max && *nblocks > nbperpage)
nb = nblks = (max > nbperpage) ? max : nbperpage;
--
2.34.1
Powered by blists - more mailing lists