summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-10-03 16:48:53 +0200
committerDavid Sterba <dsterba@suse.com>2016-10-05 12:39:01 +0200
commitea0fd88b5a443947aab2162b59d06b3f6f6e1649 (patch)
tree91579e583921e1bbece1f71b932e36cc1cc30c81 /volumes.c
parent61d5425fd3a089c6ffbad62b145f1a06c21ff860 (diff)
btrfs-progs: don't access freed memory in btrfs_close_devices
Caught by ASAN, as we don't access fs_devices directly, there's no null deref but 0x30 is still wrong. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/volumes.c b/volumes.c
index da797517..b9ca5502 100644
--- a/volumes.c
+++ b/volumes.c
@@ -162,6 +162,8 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
struct btrfs_device *device;
again:
+ if (!fs_devices)
+ return 0;
while (!list_empty(&fs_devices->devices)) {
device = list_entry(fs_devices->devices.next,
struct btrfs_device, dev_list);