Skip to content

Commit 25e70c6

Browse files
qlyjsldkleikamp
authored andcommitted
fs: jfs: fix shift-out-of-bounds in dbDiscardAG
This should be applied to most URSAN bugs found recently by syzbot, by guarding the dbMount. As syzbot feeding rubbish into the bmap descriptor. Signed-off-by: Hoi Pok Wu <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]>
1 parent ebe0603 commit 25e70c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/jfs/jfs_dmap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ int dbMount(struct inode *ipbmap)
198198
goto err_release_metapage;
199199
}
200200

201+
if (((bmp->db_mapsize - 1) >> bmp->db_agl2size) > MAXAG) {
202+
err = -EINVAL;
203+
goto err_release_metapage;
204+
}
205+
201206
for (i = 0; i < MAXAG; i++)
202207
bmp->db_agfree[i] = le64_to_cpu(dbmp_le->dn_agfree[i]);
203208
bmp->db_agsize = le64_to_cpu(dbmp_le->dn_agsize);

0 commit comments

Comments
 (0)