Merge pull request #7702 from LK4D4/fix_panic_on_bad_device_#7701
Handle error from GetDevice early Upstream-commit: 89f64712faecddbfd92c7bfe6612dd5890c966dd Component: engine
This commit is contained in:
@@ -230,10 +230,10 @@ func populateCommand(c *Container, env []string) error {
|
||||
userSpecifiedDevices := make([]*devices.Device, len(c.hostConfig.Devices))
|
||||
for i, deviceMapping := range c.hostConfig.Devices {
|
||||
device, err := devices.GetDevice(deviceMapping.PathOnHost, deviceMapping.CgroupPermissions)
|
||||
device.Path = deviceMapping.PathInContainer
|
||||
if err != nil {
|
||||
return fmt.Errorf("error gathering device information while adding custom device %s", err)
|
||||
return fmt.Errorf("error gathering device information while adding custom device %q: %s", deviceMapping.PathOnHost, err)
|
||||
}
|
||||
device.Path = deviceMapping.PathInContainer
|
||||
userSpecifiedDevices[i] = device
|
||||
}
|
||||
allowedDevices := append(devices.DefaultAllowedDevices, userSpecifiedDevices...)
|
||||
|
||||
Reference in New Issue
Block a user