[lxc-devel] [lxd/master] lxd/storage: Fix crash on VM unpack

stgraber on Github lxc-bot at linuxcontainers.org
Mon Mar 16 17:10:08 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200316/320303c0/attachment.bin>
-------------- next part --------------
From 1eea39cbcc7fdf364ad7a3984d4d06529b4c5c3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 16 Mar 2020 13:09:54 -0400
Subject: [PATCH] lxd/storage: Fix crash on VM unpack
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage/utils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage/utils.go b/lxd/storage/utils.go
index 88346a43af..9cb9246004 100644
--- a/lxd/storage/utils.go
+++ b/lxd/storage/utils.go
@@ -606,7 +606,7 @@ func ImageUnpack(imageFile, destPath, destBlockFile string, blockBackend, runnin
 		return err
 	}
 
-	if fileInfo.IsDir() {
+	if fileInfo != nil && fileInfo.IsDir() {
 		// If the dest block file exists, and it is a directory, fail.
 		return fmt.Errorf("Root block path isn't a file: %s", destBlockFile)
 	}


More information about the lxc-devel mailing list