* [PATCH] btrfs-progs: Check the csum tree node before go through the csum tree
@ 2014-09-30 8:52 Qu Wenruo
2014-10-06 1:15 ` Qu Wenruo
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2014-09-30 8:52 UTC (permalink / raw)
To: linux-btrfs
[BUG]
Some fsfuzzed btrfs image will cause btrfsck segfault.
[REPRODUCER]
Run btrfsck on a csum tree block corrupted image.
[REASON]
check_csums() function call btrfs_search_slot() on csum_tree but doesn't
check whether the csum_tree contains a valid extent_buffer, which causes
the segfault.
[FIX]
Check the csum_root->node before any search.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
cmds-check.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmds-check.c b/cmds-check.c
index 9471709..537376a 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -3905,6 +3905,10 @@ static int check_csums(struct btrfs_root *root)
unsigned long leaf_offset;
root = root->fs_info->csum_root;
+ if (!extent_buffer_uptodate(root->node)) {
+ fprintf(stderr, "No valid csum tree found\n");
+ return -ENOENT;
+ }
key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
key.type = BTRFS_EXTENT_CSUM_KEY;
--
2.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: Check the csum tree node before go through the csum tree
2014-09-30 8:52 [PATCH] btrfs-progs: Check the csum tree node before go through the csum tree Qu Wenruo
@ 2014-10-06 1:15 ` Qu Wenruo
2014-10-06 3:17 ` Qu Wenruo
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2014-10-06 1:15 UTC (permalink / raw)
To: linux-btrfs
Please ignore this patch since Wang's patch has already fixed them.
https://patchwork.kernel.org/patch/4254631/
Thanks,
Qu
-------- Original Message --------
Subject: [PATCH] btrfs-progs: Check the csum tree node before go through
the csum tree
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Date: 2014年09月30日 16:52
> [BUG]
> Some fsfuzzed btrfs image will cause btrfsck segfault.
>
> [REPRODUCER]
> Run btrfsck on a csum tree block corrupted image.
>
> [REASON]
> check_csums() function call btrfs_search_slot() on csum_tree but doesn't
> check whether the csum_tree contains a valid extent_buffer, which causes
> the segfault.
>
> [FIX]
> Check the csum_root->node before any search.
>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
> cmds-check.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/cmds-check.c b/cmds-check.c
> index 9471709..537376a 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -3905,6 +3905,10 @@ static int check_csums(struct btrfs_root *root)
> unsigned long leaf_offset;
>
> root = root->fs_info->csum_root;
> + if (!extent_buffer_uptodate(root->node)) {
> + fprintf(stderr, "No valid csum tree found\n");
> + return -ENOENT;
> + }
>
> key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
> key.type = BTRFS_EXTENT_CSUM_KEY;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: Check the csum tree node before go through the csum tree
2014-10-06 1:15 ` Qu Wenruo
@ 2014-10-06 3:17 ` Qu Wenruo
0 siblings, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2014-10-06 3:17 UTC (permalink / raw)
To: linux-btrfs
Oh, I'm sorry that the patch is still needed...
Wang's patch did fix the problem...
Thanks,
Qu
-------- Original Message --------
Subject: Re: [PATCH] btrfs-progs: Check the csum tree node before go
through the csum tree
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Date: 2014年10月06日 09:15
> Please ignore this patch since Wang's patch has already fixed them.
>
> https://patchwork.kernel.org/patch/4254631/
>
> Thanks,
> Qu
> -------- Original Message --------
> Subject: [PATCH] btrfs-progs: Check the csum tree node before go
> through the csum tree
> From: Qu Wenruo <quwenruo@cn.fujitsu.com>
> To: <linux-btrfs@vger.kernel.org>
> Date: 2014年09月30日 16:52
>> [BUG]
>> Some fsfuzzed btrfs image will cause btrfsck segfault.
>>
>> [REPRODUCER]
>> Run btrfsck on a csum tree block corrupted image.
>>
>> [REASON]
>> check_csums() function call btrfs_search_slot() on csum_tree but doesn't
>> check whether the csum_tree contains a valid extent_buffer, which causes
>> the segfault.
>>
>> [FIX]
>> Check the csum_root->node before any search.
>>
>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>> ---
>> cmds-check.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/cmds-check.c b/cmds-check.c
>> index 9471709..537376a 100644
>> --- a/cmds-check.c
>> +++ b/cmds-check.c
>> @@ -3905,6 +3905,10 @@ static int check_csums(struct btrfs_root *root)
>> unsigned long leaf_offset;
>> root = root->fs_info->csum_root;
>> + if (!extent_buffer_uptodate(root->node)) {
>> + fprintf(stderr, "No valid csum tree found\n");
>> + return -ENOENT;
>> + }
>> key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
>> key.type = BTRFS_EXTENT_CSUM_KEY;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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
end of thread, other threads:[~2014-10-06 3:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30 8:52 [PATCH] btrfs-progs: Check the csum tree node before go through the csum tree Qu Wenruo
2014-10-06 1:15 ` Qu Wenruo
2014-10-06 3:17 ` Qu Wenruo
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).