jfs: fix im_l2nbperiext shift out of bounds
PATCH 1/1 jfs: fix im_l2nbperiext shift out of bounds
When reading im_l2nbperiext from disk, check if its value is valid. Since im_l2nbperiext is the log2 of a 32 bit number, its maximum value is 31.
Reported-by [email protected]
Signed-off-by Pedro Demarchi Gomes <[email protected]>
--- fs/jfs/jfs_imap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/jfs/jfs_imap.c +4 -0
@@ -124,6 +124,10 @@ int diMount(struct inode *ipimap)atomic_set (&imap->im_numfree,le32_to_cpu (dinom_le->in_numfree)); imap->im_nbperiext =le32_to_cpu (dinom_le->in_nbperiext); imap->im_l2nbperiext =le32_to_cpu (dinom_le->in_l2nbperiext); +if (imap->im_l2nbperiext >31 ) { +jfs_err ("diMount: invalid im_l2nbperiext" ); +return -EIO ; + }for (index =0 ; index <MAXAG ; index++) { imap->im_agctl[index].inofree =le32_to_cpu (dinom_le->in_agctl[index].inofree);
Signature · 1 line
2.39.5