Patch "xfs: limit entries returned when counting fsmap records" has been added to the 5.4-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

    xfs: limit entries returned when counting fsmap records

to the 5.4-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:
     xfs-limit-entries-returned-when-counting-fsmap-recor.patch
and it can be found in the queue-5.4 subdirectory.

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



commit c53150ed001828504edf58257d019aed5bfedaed
Author: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
Date:   Thu Oct 1 10:56:07 2020 -0700

    xfs: limit entries returned when counting fsmap records
    
    [ Upstream commit acd1ac3aa22fd58803a12d26b1ab7f70232f8d8d ]
    
    If userspace asked fsmap to count the number of entries, we cannot
    return more than UINT_MAX entries because fmh_entries is u32.
    Therefore, stop counting if we hit this limit or else we will waste time
    to return truncated results.
    
    Fixes: e89c041338ed ("xfs: implement the GETFSMAP ioctl")
    Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Reviewed-by: Chandan Babu R <chandanrlinux@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c
index c13754e119be1..5b864985bc648 100644
--- a/fs/xfs/xfs_fsmap.c
+++ b/fs/xfs/xfs_fsmap.c
@@ -255,6 +255,9 @@ xfs_getfsmap_helper(
 
 	/* Are we just counting mappings? */
 	if (info->head->fmh_count == 0) {
+		if (info->head->fmh_entries == UINT_MAX)
+			return -ECANCELED;
+
 		if (rec_daddr > info->next_daddr)
 			info->head->fmh_entries++;
 



[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