The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2395

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner <christian.brau...@canonical.com>

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x47fe07]

goroutine 14 [running]:
panic(0xbad660, 0xc82000e160)
        /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3e6
main.(*Daemon).ImageDownload(0xc820086a00, 0x0, 0xc8207708a0, 0x22, 0xd075d0, 0xd, 0x0, 0x0, 0x0, 0x0, ...)
        /home/stgraber/data/code/go/src/github.com/lxc/lxd/lxd/daemon_images.go:119 +0x6457
main.autoUpdateImages(0xc820086a00)
        /home/stgraber/data/code/go/src/github.com/lxc/lxd/lxd/images.go:882 +0x8a4
main.(*Daemon).Ready.func2(0xc820086a00)
        /home/stgraber/data/code/go/src/github.com/lxc/lxd/lxd/daemon.go:1013 +0x30
created by main.(*Daemon).Ready
        /home/stgraber/data/code/go/src/github.com/lxc/lxd/lxd/daemon.go:1034 +0xe5
```
From f94a22a042fe8123b4d0c58d0c44202cea5c9bb4 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@canonical.com>
Date: Sun, 18 Sep 2016 02:25:33 +0200
Subject: [PATCH] lxd/daemon_images: avoid null deref

Signed-off-by: Christian Brauner <christian.brau...@canonical.com>
---
 lxd/daemon_images.go | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lxd/daemon_images.go b/lxd/daemon_images.go
index c589f7a..b7ea919 100644
--- a/lxd/daemon_images.go
+++ b/lxd/daemon_images.go
@@ -29,6 +29,7 @@ var imageStreamCacheLock sync.Mutex
 func (d *Daemon) ImageDownload(op *operation, server string, protocol string, 
certificate string, secret string, alias string, forContainer bool, autoUpdate 
bool) (string, error) {
        var err error
        var ss *shared.SimpleStreams
+       var ctxMap log.Ctx
 
        if protocol == "" {
                protocol = "lxd"
@@ -114,9 +115,13 @@ func (d *Daemon) ImageDownload(op *operation, server 
string, protocol string, ce
 
        d.imagesDownloadingLock.RUnlock()
 
-       shared.LogInfo(
-               "Downloading image",
-               log.Ctx{"trigger": op.url, "image": fp, "operation": op.id, 
"alias": alias, "server": server})
+       if op == nil {
+               ctxMap = log.Ctx{"alias": alias, "server": server}
+       } else {
+               ctxMap = log.Ctx{"trigger": op.url, "image": fp, "operation": 
op.id, "alias": alias, "server": server}
+       }
+
+       shared.LogInfo("Downloading image", ctxMap)
 
        // Add the download to the queue
        d.imagesDownloadingLock.Lock()
@@ -233,9 +238,7 @@ func (d *Daemon) ImageDownload(op *operation, server 
string, protocol string, ce
                        }
                }
 
-               shared.LogInfo(
-                       "Image downloaded",
-                       log.Ctx{"image": fp, "fingerprint": fp, "operation": 
op.id, "alias": alias, "server": server})
+               shared.LogInfo("Image downloaded", ctxMap)
 
                if forContainer {
                        return fp, dbImageLastAccessInit(d.db, fp)
@@ -401,9 +404,7 @@ func (d *Daemon) ImageDownload(op *operation, server 
string, protocol string, ce
                }
        }
 
-       shared.LogInfo(
-               "Image downloaded",
-               log.Ctx{"image": fp, "operation": op.id, "alias": alias, 
"server": server})
+       shared.LogInfo("Image downloaded", ctxMap)
 
        if forContainer {
                return fp, dbImageLastAccessInit(d.db, fp)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to