Protect cap access in driver()

Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
Alessandro Boch 2016-05-15 18:10:50 -07:00
parent 156f9aefef
commit b82101c4cc

View file

@ -665,7 +665,10 @@ func (n *network) driver(load bool) (driverapi.Driver, error) {
c := n.getController()
n.Lock()
n.scope = cap.DataScope
// If load is not required, driver, cap and err may all be nil
if cap != nil {
n.scope = cap.DataScope
}
if c.cfg.Daemon.IsAgent {
// If we are running in agent mode then all networks
// in libnetwork are local scope regardless of the