aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2013-06-22 13:32:42 +0800
committerChris Mason <chris.mason@fusionio.com>2013-07-03 14:16:09 -0400
commit785bfe3923f9dbc71e6e316d3c27afed5fbcf6d4 (patch)
tree927a3d8c4fe1c99b9ee049df168da8cd1011a2dc
parent699e69b7bd7b6a4736e8e7efc61db6ce43e8014e (diff)
downloadbtrfs-progs-785bfe3923f9dbc71e6e316d3c27afed5fbcf6d4.tar.gz
btrfs-progs-785bfe3923f9dbc71e6e316d3c27afed5fbcf6d4.tar.xz
btrfs-progs-785bfe3923f9dbc71e6e316d3c27afed5fbcf6d4.zip
Btrfs-progs: skip open devices which is missing
A device can be added to the device list without getting a name, so we may access to illegal addresses while opening devices with their name. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--volumes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/volumes.c b/volumes.c
index d6f81f8..013bfd5 100644
--- a/volumes.c
+++ b/volumes.c
@@ -186,6 +186,10 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, int flags)
list_for_each(cur, head) {
device = list_entry(cur, struct btrfs_device, dev_list);
+ if (!device->name) {
+ printk("no name for device %llu, skip it now\n", device->devid);
+ continue;
+ }
fd = open(device->name, flags);
if (fd < 0) {