From ea0fd88b5a443947aab2162b59d06b3f6f6e1649 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 3 Oct 2016 16:48:53 +0200 Subject: [PATCH] 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 --- volumes.c | 2 ++ 1 file changed, 2 insertions(+) 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);