Patch "fs/jfs: Add check for negative db_l2nbperpage" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fs/jfs: Add check for negative db_l2nbperpage

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-jfs-add-check-for-negative-db_l2nbperpage.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2a865e9418c08f855ed0dcf51bffba1bc5f6daba
Author: Juntong Deng <juntong.deng@xxxxxxxxxxx>
Date:   Mon Oct 2 17:56:58 2023 +0800

    fs/jfs: Add check for negative db_l2nbperpage
    
    [ Upstream commit 525b861a008143048535011f3816d407940f4bfa ]
    
    l2nbperpage is log2(number of blks per page), and the minimum legal
    value should be 0, not negative.
    
    In the case of l2nbperpage being negative, an error will occur
    when subsequently used as shift exponent.
    
    Syzbot reported this bug:
    
    UBSAN: shift-out-of-bounds in fs/jfs/jfs_dmap.c:799:12
    shift exponent -16777216 is negative
    
    Reported-by: syzbot+debee9ab7ae2b34b0307@xxxxxxxxxxxxxxxxxxxxxxxxx
    Closes: https://syzkaller.appspot.com/bug?extid=debee9ab7ae2b34b0307
    Signed-off-by: Juntong Deng <juntong.deng@xxxxxxxxxxx>
    Signed-off-by: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 95e8f031c3f11..070638718be32 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -193,7 +193,8 @@ int dbMount(struct inode *ipbmap)
 	bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
 
 	bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
-	if (bmp->db_l2nbperpage > L2PSIZE - L2MINBLOCKSIZE) {
+	if (bmp->db_l2nbperpage > L2PSIZE - L2MINBLOCKSIZE ||
+		bmp->db_l2nbperpage < 0) {
 		err = -EINVAL;
 		goto err_release_metapage;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux