Patch "ntfs: add sanity check on allocation size" has been added to the 5.15-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

    ntfs: add sanity check on allocation size

to the 5.15-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:
     ntfs-add-sanity-check-on-allocation-size.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 1fb14ae74206bcd9a3b284c95d30c998a00e67fd
Author: Dongliang Mu <mudongliangabcd@xxxxxxxxx>
Date:   Tue Mar 22 14:38:39 2022 -0700

    ntfs: add sanity check on allocation size
    
    [ Upstream commit 714fbf2647b1a33d914edd695d4da92029c7e7c0 ]
    
    ntfs_read_inode_mount invokes ntfs_malloc_nofs with zero allocation
    size.  It triggers one BUG in the __ntfs_malloc function.
    
    Fix this by adding sanity check on ni->attr_list_size.
    
    Link: https://lkml.kernel.org/r/20220120094914.47736-1-dzm91@xxxxxxxxxxx
    Reported-by: syzbot+3c765c5248797356edaa@xxxxxxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Dongliang Mu <mudongliangabcd@xxxxxxxxx>
    Acked-by: Anton Altaparmakov <anton@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 4474adb393ca..517b71c73aa9 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1881,6 +1881,10 @@ int ntfs_read_inode_mount(struct inode *vi)
 		}
 		/* Now allocate memory for the attribute list. */
 		ni->attr_list_size = (u32)ntfs_attr_size(a);
+		if (!ni->attr_list_size) {
+			ntfs_error(sb, "Attr_list_size is zero");
+			goto put_err_out;
+		}
 		ni->attr_list = ntfs_malloc_nofs(ni->attr_list_size);
 		if (!ni->attr_list) {
 			ntfs_error(sb, "Not enough memory to allocate buffer "



[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