Commit 7db6e666 authored by Sergey Bashirov's avatar Sergey Bashirov Committed by Trond Myklebust
Browse files

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: default avatarSergey Bashirov <sergeybashirov@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250702133226.212537-1-sergeybashirov@gmail.com


Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 81438498
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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) {