]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/xfs-fix-overflow-in-xfs_growfs_data_private
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / xfs-fix-overflow-in-xfs_growfs_data_private
1 From: Eric Sandeen <sandeen@sandeen.net>
2 Date: Sat, 23 May 2009 19:30:12 +0000 (-0500)
3 Subject: xfs: fix overflow in xfs_growfs_data_private
4 Patch-mainline: 2.6.30-rc8
5 Git-commit: e6da7c9fed111ba1243297ee6eda8e24ae11c384
6 References: bnc#506361
7
8 xfs: fix overflow in xfs_growfs_data_private
9
10 In the case where growing a filesystem would leave the last AG
11 too small, the fixup code has an overflow in the calculation
12 of the new size with one fewer ag, because "nagcount" is a 32
13 bit number. If the new filesystem has > 2^32 blocks in it
14 this causes a problem resulting in an EINVAL return from growfs:
15
16 # xfs_io -f -c "truncate 19998630180864" fsfile
17 # mkfs.xfs -f -bsize=4096 -dagsize=76288719b,size=3905982455b fsfile
18 # mount -o loop fsfile /mnt
19 # xfs_growfs /mnt
20
21 meta-data=/dev/loop0 isize=256 agcount=52,
22 agsize=76288719 blks
23 = sectsz=512 attr=2
24 data = bsize=4096 blocks=3905982455, imaxpct=5
25 = sunit=0 swidth=0 blks
26 naming =version 2 bsize=4096 ascii-ci=0
27 log =internal bsize=4096 blocks=32768, version=2
28 = sectsz=512 sunit=0 blks, lazy-count=0
29 realtime =none extsz=4096 blocks=0, rtextents=0
30 xfs_growfs: XFS_IOC_FSGROWFSDATA xfsctl failed: Invalid argument
31
32 Reported-by: richard.ems@cape-horn-eng.com
33 Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
34 Reviewed-by: Christoph Hellwig <hch@lst.de>
35 Reviewed-by: Felix Blyakher <felixb@sgi.com>
36 Signed-off-by: Felix Blyakher <felixb@sgi.com>
37 Acked-by: Jeff Mahoney <jeffm@suse.com>
38 ---
39
40 fs/xfs/xfs_fsops.c | 2 +-
41 1 file changed, 1 insertion(+), 1 deletion(-)
42
43 diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
44 index 8379e3b..cbd451b 100644
45 --- a/fs/xfs/xfs_fsops.c
46 +++ b/fs/xfs/xfs_fsops.c
47 @@ -160,7 +160,7 @@ xfs_growfs_data_private(
48 nagcount = new + (nb_mod != 0);
49 if (nb_mod && nb_mod < XFS_MIN_AG_BLOCKS) {
50 nagcount--;
51 - nb = nagcount * mp->m_sb.sb_agblocks;
52 + nb = (xfs_rfsblock_t)nagcount * mp->m_sb.sb_agblocks;
53 if (nb < mp->m_sb.sb_dblocks)
54 return XFS_ERROR(EINVAL);
55 }