Skip to content

Commit

Permalink
iomap: avoid avoid truncating 64-bit offset to 32 bits
Browse files Browse the repository at this point in the history
commit c13094b894de289514d84b8db56d1f2931a0bade upstream.

on 32-bit kernels, iomap_write_delalloc_scan() was inadvertently using a
32-bit position due to folio_next_index() returning an unsigned long.
This could lead to an infinite loop when writing to an xfs filesystem.

Signed-off-by: Marco Nelissen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Darrick J. Wong <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
  • Loading branch information
marcone authored and pelwell committed Jan 10, 2025
1 parent e30a581 commit 57957c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/iomap/buffered-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ static void iomap_write_delalloc_scan(struct inode *inode,
start_byte, end_byte, iomap, punch);

/* move offset to start of next folio in range */
start_byte = folio_next_index(folio) << PAGE_SHIFT;
start_byte = folio_pos(folio) + folio_size(folio);
folio_unlock(folio);
folio_put(folio);
}
Expand Down

0 comments on commit 57957c8

Please sign in to comment.