commit | e62f1ba7f073fc6d8428472c0942a4028350a270 | [log] [tgz] |
---|---|---|
author | Stephen Warren <swarren@nvidia.com> | Wed Jun 11 12:46:16 2014 -0600 |
committer | Tom Rini <trini@ti.com> | Thu Jun 19 11:18:53 2014 -0400 |
tree | 24546aa499a82610c0af24849a6239fc7cd09130 | |
parent | 9a3b4de6a7f5ac059378648c823f9f3c3fedd776 [diff] |
fs: ext4: fix writing zero-length files ext4fs_allocate_blocks() always allocates at least one block for a file. If the file size is zero, this causes total_remaining_blocks to underflow, which then causes an apparent hang while 2^32 blocks are allocated. To solve this, check that total_remaining_blocks is non-zero as part of the loop condition (i.e. before each loop) rather than at the end of the loop. Signed-off-by: Stephen Warren <swarren@nvidia.com>