linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pNFS: Fix disk addr range check in block/scsi layout
@ 2025-07-02 13:32 Sergey Bashirov
  2025-07-03 13:07 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Bashirov @ 2025-07-02 13:32 UTC (permalink / raw)
  To: Christoph Hellwig, Trond Myklebust, Anna Schumaker
  Cc: linux-nfs, linux-kernel, Konstantin Evtushenko, 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.

Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
---
 fs/nfs/blocklayout/blocklayout.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 47189476b553..5d6edafbed20 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -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) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pNFS: Fix disk addr range check in block/scsi layout
  2025-07-02 13:32 [PATCH] pNFS: Fix disk addr range check in block/scsi layout Sergey Bashirov
@ 2025-07-03 13:07 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2025-07-03 13:07 UTC (permalink / raw)
  To: Sergey Bashirov
  Cc: Christoph Hellwig, Trond Myklebust, Anna Schumaker, linux-nfs,
	linux-kernel, Konstantin Evtushenko

On Wed, Jul 02, 2025 at 04:32:21PM +0300, Sergey Bashirov wrote:
> 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:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-03 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 13:32 [PATCH] pNFS: Fix disk addr range check in block/scsi layout Sergey Bashirov
2025-07-03 13:07 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).