mirror of
https://gitee.com/bianbu-linux/linux-6.6-fh
synced 2025-04-24 20:27:07 -04:00
jfs: Fix shift-out-of-bounds in dbDiscardAG
[ Upstream commit 7063b80268e2593e58bee8a8d709c2f3ff93e2f2 ] When searching for the next smaller log2 block, BLKSTOL2() returned 0, causing shift exponent -1 to be negative. This patch fixes the issue by exiting the loop directly when negative shift is found. Reported-by: syzbot+61be3359d2ee3467e7e4@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=61be3359d2ee3467e7e4 Signed-off-by: Pei Li <peili.dev@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6ea10dbb1e
commit
f650148b43
1 changed files with 2 additions and 0 deletions
|
@ -1626,6 +1626,8 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
|
|||
} else if (rc == -ENOSPC) {
|
||||
/* search for next smaller log2 block */
|
||||
l2nb = BLKSTOL2(nblocks) - 1;
|
||||
if (unlikely(l2nb < 0))
|
||||
break;
|
||||
nblocks = 1LL << l2nb;
|
||||
} else {
|
||||
/* Trim any already allocated blocks */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue