devmapper: Fix MountDevice for non-existing Device

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
Alexander Larsson 2014-02-06 23:08:17 +01:00
parent 304e33a2fe
commit 693d3f8c6a
1 changed files with 3 additions and 0 deletions

View File

@ -804,6 +804,9 @@ func (devices *DeviceSet) MountDevice(hash, path string) error {
defer devices.Unlock() defer devices.Unlock()
info := devices.Devices[hash] info := devices.Devices[hash]
if info == nil {
return fmt.Errorf("Unknown device %s", hash)
}
if info.mountCount > 0 { if info.mountCount > 0 {
if path != info.mountPath { if path != info.mountPath {