Skip to contentSkip to conversation

pNFS: Fix disk addr range check in block/scsi layout

PATCH In review Sergey Bashirov 2 participants 2 messages Jul 2, 2025 – Jul 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 fs/nfs/blocklayout/blocklayout.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/blocklayout.c +2 -2
index 47189476b553..5d6edafbed20 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Sergey Bashirov

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.

Looks good: