linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 01/15] gfs2: Fix length of holes reported at end-of-file
@ 2021-11-26  2:35 Sasha Levin
  2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 02/15] tun: fix bonding active backup with arp monitoring Sasha Levin
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Sasha Levin @ 2021-11-26  2:35 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Andreas Gruenbacher, Sasha Levin, rpeterso, cluster-devel

From: Andreas Gruenbacher <agruenba@redhat.com>

[ Upstream commit f3506eee81d1f700d9ee2d2f4a88fddb669ec032 ]

Fix the length of holes reported at the end of a file: the length is
relative to the beginning of the extent, not the seek position which is
rounded down to the filesystem block size.

This bug went unnoticed for some time, but is now caught by the
following assertion in iomap_iter_done():

  WARN_ON_ONCE(iter->iomap.offset + iter->iomap.length <= iter->pos)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/gfs2/bmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 43f53020553b5..53ba5019ad063 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -943,7 +943,7 @@ static int gfs2_iomap_get(struct inode *inode, loff_t pos, loff_t length,
 		else if (height == ip->i_height)
 			ret = gfs2_hole_size(inode, lblock, len, mp, iomap);
 		else
-			iomap->length = size - pos;
+			iomap->length = size - iomap->offset;
 	} else if (flags & IOMAP_WRITE) {
 		u64 alloc_size;
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-11-26  2:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26  2:35 [PATCH AUTOSEL 4.19 01/15] gfs2: Fix length of holes reported at end-of-file Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 02/15] tun: fix bonding active backup with arp monitoring Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 03/15] atlantic: Fix OOB read and write in hw_atl_utils_fw_rpc_wait Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 04/15] net: return correct error code Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 05/15] pinctrl: amd: Fix wakeups when IRQ is shared with SCI Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 06/15] platform/x86: thinkpad_acpi: Fix WWAN device disabled issue after S3 deep Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 07/15] s390/setup: avoid using memblock_enforce_memory_limit Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 08/15] btrfs: check-integrity: fix a warning on write caching disabled disk Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 09/15] thermal: core: Reset previous low and high trip during thermal zone init Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 10/15] scsi: iscsi: Unblock session then wake up error handler Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 11/15] ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 12/15] ethernet: hisilicon: hns: hns_dsaf_misc: fix a possible array overflow in hns_dsaf_ge_srst_by_port() Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 13/15] net: tulip: de4x5: fix the problem that the array 'lp->phy[8]' may be out of bound Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 14/15] net: ethernet: dec: tulip: de4x5: fix possible array overflows in type3_infoblock() Sasha Levin
2021-11-26  2:35 ` [PATCH AUTOSEL 4.19 15/15] perf hist: Fix memory leak of a perf_hpp_fmt Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).