]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pNFS: Fix disk addr range check in block/scsi layout
authorSergey Bashirov <sergeybashirov@gmail.com>
Wed, 2 Jul 2025 13:32:21 +0000 (16:32 +0300)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 14 Jul 2025 22:20:28 +0000 (15:20 -0700)
At the end of the isect translation, disc_addr represents the physical
disk offset. Thus, end calculated from disk_addr is also a physical disk
offset. Therefore, range checking should be done using map->disk_offset,
not map->start.

Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250702133226.212537-1-sergeybashirov@gmail.com
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/blocklayout/blocklayout.c

index 47189476b5538bd277fec46254631025c642c7d3..5d6edafbed202ae730443d7e3f95721a40bf0eda 100644 (file)
@@ -149,8 +149,8 @@ do_add_page_to_bio(struct bio *bio, int npg, enum req_op op, sector_t isect,
 
        /* limit length to what the device mapping allows */
        end = disk_addr + *len;
-       if (end >= map->start + map->len)
-               *len = map->start + map->len - disk_addr;
+       if (end >= map->disk_offset + map->len)
+               *len = map->disk_offset + map->len - disk_addr;
 
 retry:
        if (!bio) {