Re: [PATCH] affs: honor copied length in OFS write_end

From: David Sterba

Date: Wed Nov 04 2026 - 12:20:10 EST


On Wed, Nov 04, 2026 at 10:37:02AM +0000, Hungyu Lin wrote:
> affs_write_end_ofs() uses the requested length instead of the number of
> bytes copied into the folio. It can therefore write data that was not
> copied and report more bytes than the source iterator consumed.
>
> generic_perform_write() then advances the file position without making
> the corresponding progress through the source iterator. A one-byte
> pwrite() from an unreadable buffer at EOF can repeatedly grow the file
> instead of failing with EFAULT. Partial copies are overreported as well.
>
> Limit the range written to the copied bytes. When nothing was copied,
> unlock and put the folio without modifying block metadata or reporting
> progress. Remove the obsolete comment: an uptodate destination folio does
> not guarantee that the copy from the source succeeded.
>
> Fixes: f2b6a16eb8f5 ("fs: affs convert to new aops")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>

Thanks, added to queue.