]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iomap: sub-block dio needs to zeroout beyond EOF
authorDave Chinner <dchinner@redhat.com>
Mon, 19 Nov 2018 21:31:10 +0000 (13:31 -0800)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:09 +0000 (14:22 -0300)
commit42cac6f935a44c9237d4c4f264ae22e0f2fca3a4
treeee6a96b394309cad5621eab5c5b6e4f7567b16ce
parente438ce861256215f103dd614f85d363bba1abc3d
iomap: sub-block dio needs to zeroout beyond EOF

BugLink: https://bugs.launchpad.net/bugs/1857158
[ Upstream commit b450672fb66b4a991a5b55ee24209ac7ae7690ce ]

If we are doing sub-block dio that extends EOF, we need to zero
the unused tail of the block to initialise the data in it it. If we
do not zero the tail of the block, then an immediate mmap read of
the EOF block will expose stale data beyond EOF to userspace. Found
with fsx running sub-block DIO sizes vs MAPREAD/MAPWRITE operations.

Fix this by detecting if the end of the DIO write is beyond EOF
and zeroing the tail if necessary.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/iomap.c