All of lore.kernel.org
 help / color / mirror / Atom feed
* Request for inclusion on linux-4.14.y and linux-5.4.y
@ 2020-06-25 22:47 yishache
  2020-06-25 22:47 ` [PATCH] xfs: add agf freeblocks verify in xfs_agf_verify yishache
  0 siblings, 1 reply; 7+ messages in thread
From: yishache @ 2020-06-25 22:47 UTC (permalink / raw)
  To: gregkh; +Cc: stable

Hello Greg,

Can you please consider including the following patch in the stable linux-4.14.y branch?

This is to fix CVE-2020-12655

d0c7feaf87678371c2c09b3709400be416b2dc62(xfs: add agf freeblocks verify in xfs_agf_verify)

Thanks,
Yishan Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Request for inclusion on linux-4.14.y and linux-5.4.y
@ 2020-06-25 22:59 yishache
  2020-06-25 22:59 ` [PATCH] xfs: add agf freeblocks verify in xfs_agf_verify yishache
  0 siblings, 1 reply; 7+ messages in thread
From: yishache @ 2020-06-25 22:59 UTC (permalink / raw)
  To: gregkh; +Cc: stable

Hello Greg,

Can you please consider including the following patch in the stable linux-4.14.y and stable linux-5.4.y branch?

This is to fix CVE-2020-12655

d0c7feaf87678371c2c09b3709400be416b2dc62(xfs: add agf freeblocks verify in xfs_agf_verify)

Thanks,
Yishan Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] xfs: add agf freeblocks verify in xfs_agf_verify
@ 2020-02-13  9:53 Zheng Bin
  2020-02-13 13:37 ` Eric Sandeen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Zheng Bin @ 2020-02-13  9:53 UTC (permalink / raw)
  To: david, darrick.wong, sandeen, linux-xfs; +Cc: renxudong1

We recently used fuzz(hydra) to test XFS and automatically generate
tmp.img(XFS v5 format, but some metadata is wrong)

Test as follows:
mount tmp.img tmpdir
cp file1M tmpdir
sync

tmpdir/file1M size is 1M, but its data can not sync to disk.

This is because tmp.img has some problems, using xfs_repair detect
information as follows:

agf_freeblks 0, counted 3224 in ag 0
agf_longest 536874136, counted 3224 in ag 0
sb_fdblocks 613, counted 3228

Add these agf freeblocks checks:
1. agf_longest < agf_freeblks
2. agf_freeblks < sb_fdblocks

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
Signed-off-by: Ren Xudong <renxudong1@huawei.com>
---
 fs/xfs/libxfs/xfs_alloc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index d8053bc..0f4b4d1 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -2858,6 +2858,10 @@ xfs_agf_verify(
 	      be32_to_cpu(agf->agf_flcount) <= xfs_agfl_size(mp)))
 		return __this_address;

+	if (be32_to_cpu(agf->agf_freeblks) < be32_to_cpu(agf->agf_longest) ||
+	    be32_to_cpu(agf->agf_freeblks) >= mp->m_sb.sb_fdblocks)
+		return __this_address;
+
 	if (be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) < 1 ||
 	    be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) < 1 ||
 	    be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]) > XFS_BTREE_MAXLEVELS ||
--
2.7.4


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

end of thread, other threads:[~2020-06-25 23:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 22:47 Request for inclusion on linux-4.14.y and linux-5.4.y yishache
2020-06-25 22:47 ` [PATCH] xfs: add agf freeblocks verify in xfs_agf_verify yishache
  -- strict thread matches above, loose matches on Subject: below --
2020-06-25 22:59 Request for inclusion on linux-4.14.y and linux-5.4.y yishache
2020-06-25 22:59 ` [PATCH] xfs: add agf freeblocks verify in xfs_agf_verify yishache
2020-02-13  9:53 Zheng Bin
2020-02-13 13:37 ` Eric Sandeen
2020-02-13 17:44 ` Darrick J. Wong
2020-02-13 20:55 ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.