Re: [syzbot] [jfs?] UBSAN: shift-out-of-bounds in extAlloc (2)

From: Jeongjun Park
Date: Fri May 31 2024 - 07:08:09 EST


please test shift-out-of-bounds in extAlloc

#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
fs/jfs/jfs_extent.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
index 63d21822d309..7701159422a1 100644
--- a/fs/jfs/jfs_extent.c
+++ b/fs/jfs/jfs_extent.c
@@ -313,7 +313,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
*/

/* give up if no space left */
- if (bmp->db_maxfreebud == -1)
+ if (bmp->db_maxfreebud >= 0 && bmp->db_maxfreebud < 63)
return -ENOSPC;

max = (s64) 1 << bmp->db_maxfreebud;
--
2.34.1