Skip to content

exfat: fix iomap mapping vs truncate race

Youling Tang exfat lkml stable 2 versions – Applied

Status from this message: Applied them to #dev.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesApplied
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Move the valid-prefix clamp into exfat_map_cluster().

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2exfat: fix iomap mapping when writeback races with truncatefs/exfat/iomap.c+5 -40 replies
2/2exfat: don't map EXFAT_EOF_CLUSTER as a physical clusterfs/exfat/inode.c fs/exfat/iomap.c+24 -31 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchChi Zhiling
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] exfat: fix iomap mapping vs truncate race

From: Youling Tang <[email protected]>

This series fixes two related problems in the exfat iomap path.

Patch 1 fixes a race between iomap mapping and truncate: i_size was read twice, and a shrink in between could make the mapping length negative, which underflowed the cluster count.

Patch 2 fixes the handling of the EXFAT_EOF_CLUSTER sentinel. The iomap code used to convert it into a physical address; now exfat_map_cluster() maps only the valid prefix when a range straddles the end of the chain, and iomap reports the remaining range as a hole, matching the old buffer_head code.

Patch 2 relies on the non-negative length guaranteed by patch 1 for the hole mapping.

Changes since v1:
- Move the valid-prefix clamp into exfat_map_cluster().

v1: https://lore.kernel.org/exfat/[email protected]/T/#t

Youling Tang (2):
exfat: fix iomap mapping when writeback races with truncate
exfat: don't map EXFAT_EOF_CLUSTER as a physical cluster

 fs/exfat/inode.c | 15 ++++++++++++---
 fs/exfat/iomap.c | 21 +++++++++++++++++----
 2 files changed, 29 insertions(+), 7 deletions(-)
Signature · 1 line
2.43.0