* [PATCH] ext4: check for zero length extent
@ 2012-03-11 20:46 Theodore Ts'o
2012-03-12 2:00 ` Andreas Dilger
0 siblings, 1 reply; 3+ messages in thread
From: Theodore Ts'o @ 2012-03-11 20:46 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: merll, Theodore Ts'o
Explicitly test for an extent whose length is zero, and flag that as a
corrupted extent.
This avoids a kernel BUG_ON assertion failure.
Tested: Without this patch, the file system image found in
tests/f_ext_zero_len/image.gz in the latest e2fsprogs sources causes a
kernel panic. With this patch, an ext4 file systmem error is noted
instead, and the file system is marked as being corrupted.
https://bugzilla.kernel.org/show_bug.cgi?id=42859
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ext4/extents.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 74f23c2..203885c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -300,6 +300,8 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
ext4_fsblk_t block = ext4_ext_pblock(ext);
int len = ext4_ext_get_actual_len(ext);
+ if (!len)
+ return 0;
return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
}
--
1.7.9.107.g97f9a
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: check for zero length extent
2012-03-11 20:46 [PATCH] ext4: check for zero length extent Theodore Ts'o
@ 2012-03-12 2:00 ` Andreas Dilger
2012-03-12 3:30 ` Ted Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2012-03-12 2:00 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List, merll@web.de, Theodore Ts'o
On 2012-03-11, at 14:46, Theodore Ts'o <tytso@mit.edu> wrote:
> Explicitly test for an extent whose length is zero, and flag that as a
> corrupted extent.
Two minor nits in the patch:
> This avoids a kernel BUG_ON assertion failure.
>
> Tested: Without this patch, the file system image found in
> tests/f_ext_zero_len/image.gz in the latest e2fsprogs sources causes a
> kernel panic. With this patch, an ext4 file systmem error is noted
(typo) s/systmem/system/
> instead, and the file system is marked as being corrupted.
>
> https://bugzilla.kernel.org/show_bug.cgi?id=42859
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> fs/ext4/extents.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 74f23c2..203885c 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -300,6 +300,8 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
> ext4_fsblk_t block = ext4_ext_pblock(ext);
> int len = ext4_ext_get_actual_len(ext);
>
> + if (!len)
I'd prefer:
if (len == 0)
Since len is not a Boolean.
> + return 0;
> return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
> }
>
> --
> 1.7.9.107.g97f9a
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: check for zero length extent
2012-03-12 2:00 ` Andreas Dilger
@ 2012-03-12 3:30 ` Ted Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Ted Ts'o @ 2012-03-12 3:30 UTC (permalink / raw)
To: Andreas Dilger; +Cc: Ext4 Developers List, merll@web.de
On Sun, Mar 11, 2012 at 08:00:58PM -0600, Andreas Dilger wrote:
> On 2012-03-11, at 14:46, Theodore Ts'o <tytso@mit.edu> wrote:
> > Explicitly test for an extent whose length is zero, and flag that as a
> > corrupted extent.
>
> Two minor nits in the patch...
Thanks, I've made your suggested fixes.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-12 3:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-11 20:46 [PATCH] ext4: check for zero length extent Theodore Ts'o
2012-03-12 2:00 ` Andreas Dilger
2012-03-12 3:30 ` Ted Ts'o
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).