* BUG: btrfsck segfaults on regular file
@ 2009-01-19 18:16 Zach Carter
2009-01-21 2:10 ` Shen Feng
0 siblings, 1 reply; 3+ messages in thread
From: Zach Carter @ 2009-01-19 18:16 UTC (permalink / raw)
To: linux-btrfs
We should probably just get an informative error message here, not a segfault.
Also, I got the same segfault when running "btrfsck -h" (it was looking for a
file named "-h". I'd be happy to contribute a getopts patch, if that is
desired.
-Zach
[zcarter@nudj btrfs-progs-unstable]$ touch foo
[zcarter@nudj btrfs-progs-unstable]$ ./btrfsck ./foo
No valid Btrfs found on ./foo
Segmentation fault
[zcarter@nudj btrfs-progs-unstable]$ gdb ./btrfsck
GNU gdb Fedora (6.8-29.fc10)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) run ./foo
Starting program: /opt/src/btrfs-progs-unstable/btrfsck ./foo
No valid Btrfs found on ./foo
Program received signal SIGSEGV, Segmentation fault.
check_extents (root=0x0) at btrfsck.c:2006
2006 add_root_to_pending(root->fs_info->tree_root->node, bits, bits_nr,
(gdb)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: BUG: btrfsck segfaults on regular file
2009-01-19 18:16 BUG: btrfsck segfaults on regular file Zach Carter
@ 2009-01-21 2:10 ` Shen Feng
0 siblings, 0 replies; 3+ messages in thread
From: Shen Feng @ 2009-01-21 2:10 UTC (permalink / raw)
To: Zach Carter; +Cc: linux-btrfs
on 01/20/2009 02:16 AM, Zach Carter wrote:
> We should probably just get an informative error message here, not a segfault.
>
> Also, I got the same segfault when running "btrfsck -h" (it was looking for a
> file named "-h". I'd be happy to contribute a getopts patch, if that is
> desired.
>
> -Zach
>
> [zcarter@nudj btrfs-progs-unstable]$ touch foo
> [zcarter@nudj btrfs-progs-unstable]$ ./btrfsck ./foo
> No valid Btrfs found on ./foo
> Segmentation fault
> [zcarter@nudj btrfs-progs-unstable]$ gdb ./btrfsck
> GNU gdb Fedora (6.8-29.fc10)
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu"...
> (gdb) run ./foo
> Starting program: /opt/src/btrfs-progs-unstable/btrfsck ./foo
> No valid Btrfs found on ./foo
>
> Program received signal SIGSEGV, Segmentation fault.
> check_extents (root=0x0) at btrfsck.c:2006
> 2006 add_root_to_pending(root->fs_info->tree_root->node, bits, bits_nr,
> (gdb)
I think the following patch can fix this problem.
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
---
btrfsck.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/btrfsck.c b/btrfsck.c
index 4a41e6d..c95fe83 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -2074,6 +2074,8 @@ int main(int ac, char **av)
radix_tree_init();
root = open_ctree(av[1], 0, 0);
+ if (!root)
+ return 1;
ret = check_extents(root);
if (ret)
-- 1.6.0.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: BUG: btrfsck segfaults on regular file
@ 2009-04-29 21:19 nightrow
0 siblings, 0 replies; 3+ messages in thread
From: nightrow @ 2009-04-29 21:19 UTC (permalink / raw)
To: linux-btrfs
I just tried running btrsfck without enough right to open the device, i got the
same : a segfault. I also got the segfault taking a unknow device.
Please display a message like : "Unknow device or file, you may not have enough
rights to open it"
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-29 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19 18:16 BUG: btrfsck segfaults on regular file Zach Carter
2009-01-21 2:10 ` Shen Feng
-- strict thread matches above, loose matches on Subject: below --
2009-04-29 21:19 nightrow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox