jfs : fix shift-out-of-bounds in dbUpdatePMap
PATCH 1/1 jfs : fix shift-out-of-bounds in dbUpdatePMap
Currently there is no bound check for number of logical blocks per page (bmp->db_l2nbperpage). Added the required bound check for the calculation of dmap.
--- fs/jfs/jfs_dmap.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/jfs/jfs_dmap.c +4 -0
@@ -467,6 +467,10 @@ dbUpdatePMap(struct inode *ipbmap, lastlblkno =0 ;for (rem = nblocks; rem >0 ; rem -= nblks, blkno += nblks) {/* get the buffer for the current dmap. */ + +if (bmp->db_l2nbperpage >L2BPERDMAP ) +return -EIO ; + lblkno =BLKTODMAP (blkno, bmp->db_l2nbperpage);if (lblkno != lastlblkno) {if (mp) {
Signature · 6 lines
2.37.2 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 3 lines · Manas Ghandat
Currently there is no bound check for number of logical blocks per page (
bmp->db_l2nbperpage). Added the required bound check for the calculation of dmap.
This should already be fixed by 11509910c599 ("jfs: jfs_dmap: Validate db_l2nbperpage while mounting")
Can you please verify if this problem still exists in v6.5?
Shaggy
Quoted 14 lines
Reported-by [email protected]Fixes 4d81715fc5df ("[PATCH] fs/jfs: Conversion to generic boolean")Signed-off-by Manas Ghandat <[email protected]>--- fs/jfs/jfs_dmap.c | 4 ++++ 1 file changed, 4 insertions(+)fs/jfs/jfs_dmap.c +0
-0
fs/jfs/jfs_dmap.c dbUpdatePMap(struct inode *ipbmap, · line 476
Quoted 10 lines
fs/jfs/jfs_dmap.c +4
-0@@ -467,6 +467,10 @@ dbUpdatePMap(struct inode *ipbmap, lastlblkno =0 ;for (rem = nblocks; rem >0 ; rem -= nblks, blkno += nblks) {/* get the buffer for the current dmap. */ + +if (bmp->db_l2nbperpage >L2BPERDMAP ) +return -EIO ; + lblkno =BLKTODMAP (blkno, bmp->db_l2nbperpage);if (lblkno != lastlblkno) {if (mp) {
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
I checked for the v6.5. Its fixed there.
Quoted 11 lines · Dave Kleikamp
Quoted 3 lines · Manas Ghandat
Currently there is no bound check for number of logical blocks per page (
bmp->db_l2nbperpage). Added the required bound check for the calculation of dmap.This should already be fixed by
11509910c599("jfs:jfs_dmap: Validatedb_l2nbperpagewhile mounting")Can you please verify if this problem still exists in v6.5?
Shaggy
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Thanks for verifying!
Quoted 14 lines · Manas Ghandat
I checked for the v6.5. Its fixed there.
Quoted 11 lines · Dave Kleikamp
Quoted 3 lines · Manas Ghandat
Currently there is no bound check for number of logical blocks per page (
bmp->db_l2nbperpage). Added the required bound check for the calculation of dmap.This should already be fixed by
11509910c599("jfs:jfs_dmap: Validatedb_l2nbperpagewhile mounting")Can you please verify if this problem still exists in v6.5?
Shaggy
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees