pNFS: Fix disk addr range check in block/scsi layout
Subsystems (2)
PATCH 1/1 pNFS: Fix disk addr range check in block/scsi layout
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 <[email protected]>
--- fs/nfs/blocklayout/blocklayout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/blocklayout.c +2 -2
@@ -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) {
Signature · 1 line
2.43.0
Quoted 4 lines · Sergey Bashirov
At the end of the isect translation,
disc_addrrepresents the physical disk offset. Thus, end calculated fromdisk_addris also a physical disk offset. Therefore, range checking should be done usingmap->disk_offset, notmap->start.
Looks good:
Reviewed-by Christoph Hellwig <[email protected]>