Patch "fs/jfs: Add check for negative db_l2nbperpage" has been added to the 4.19-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.19-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.19 subdirectory.

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



commit 40f0282980913392a247e2b0463a1e754d6804ab
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 b20fffc8b4c13..5e20d7270d5f2 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