All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: fix incorrect n_blocks_count result when resizing file system to size larger than 2^32 blocks
@ 2017-07-28  6:23 Jerry Lee
  2017-08-06  5:18 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Jerry Lee @ 2017-07-28  6:23 UTC (permalink / raw)
  To: linux-ext4, Theodore Ts'o

On 32-bit platform, the value of n_blcoks_count may be wrong during the
file system is resized to size larger than 2^32 blocks.  This may caused
the superblock being corrupted with zero blocks count.

Signed-off-by: Jerry Lee <jerrylee@qnap.com>
---
 fs/ext4/resize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index c3ed902..035cd3f 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1927,7 +1927,8 @@ int ext4_resize_fs(struct super_block *sb,
ext4_fsblk_t n_blocks_count)
                        n_desc_blocks = o_desc_blocks +
                                le16_to_cpu(es->s_reserved_gdt_blocks);
                        n_group = n_desc_blocks * EXT4_DESC_PER_BLOCK(sb);
-                       n_blocks_count = n_group * EXT4_BLOCKS_PER_GROUP(sb);
+                       n_blocks_count = (ext4_fsblk_t)n_group *
+                               EXT4_BLOCKS_PER_GROUP(sb);
                        n_group--; /* set to last group number */
                }

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

* Re: [PATCH] ext4: fix incorrect n_blocks_count result when resizing file system to size larger than 2^32 blocks
  2017-07-28  6:23 [PATCH] ext4: fix incorrect n_blocks_count result when resizing file system to size larger than 2^32 blocks Jerry Lee
@ 2017-08-06  5:18 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-08-06  5:18 UTC (permalink / raw)
  To: Jerry Lee; +Cc: linux-ext4

On Fri, Jul 28, 2017 at 02:23:55PM +0800, Jerry Lee wrote:
> On 32-bit platform, the value of n_blcoks_count may be wrong during the
> file system is resized to size larger than 2^32 blocks.  This may caused
> the superblock being corrupted with zero blocks count.
> 
> Signed-off-by: Jerry Lee <jerrylee@qnap.com>

Thanks, applied.

				- Ted

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

end of thread, other threads:[~2017-08-06  5:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-28  6:23 [PATCH] ext4: fix incorrect n_blocks_count result when resizing file system to size larger than 2^32 blocks Jerry Lee
2017-08-06  5:18 ` Theodore Ts'o

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.