Re: [PATCH v2] fs: Fix page_mkwrite off-by-one errors
From: David Sterba
Date: Fri Nov 29 2019 - 11:06:45 EST
On Fri, Nov 29, 2019 at 03:20:45PM +0100, Andreas Gruenbacher wrote:
> The check in block_page_mkwrite meant to determine whether an offset is
> within the inode size is off by one. This bug has spread to
> iomap_page_mkwrite and to several filesystems (ubifs, ext4, f2fs, ceph).
> To fix that, introduce a new page_mkwrite_check_truncate helper that
> checks for truncate and computes the bytes in the page up to EOF, and
> use that helper in the above mentioned filesystems and in btrfs.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
>
> ---
>
> This patch has a trivial conflict with commit "iomap: Fix overflow in
> iomap_page_mkwrite" in Darrick's iomap pull request for 5.5:
>
> 20191125190907.GN6219@magnolia/">https://lore.kernel.org/lkml/20191125190907.GN6219@magnolia/
> ---
> fs/btrfs/inode.c | 15 ++++-----------
For the btrfs part
Acked-by: David Sterba <dsterba@xxxxxxxx>
and reviewed that the change is equivalent.