diff options
Diffstat (limited to 'libpod/lock/shm_lock_manager_linux.go')
-rw-r--r-- | libpod/lock/shm_lock_manager_linux.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libpod/lock/shm_lock_manager_linux.go b/libpod/lock/shm_lock_manager_linux.go index 3e8f4f3d2..94dfd7dd7 100644 --- a/libpod/lock/shm_lock_manager_linux.go +++ b/libpod/lock/shm_lock_manager_linux.go @@ -3,7 +3,10 @@ package lock import ( + "syscall" + "github.com/containers/libpod/libpod/lock/shm" + "github.com/pkg/errors" ) // SHMLockManager manages shared memory locks. @@ -60,6 +63,11 @@ func (m *SHMLockManager) RetrieveLock(id uint32) (Locker, error) { lock.lockID = id lock.manager = m + if id >= m.locks.GetMaxLocks() { + return nil, errors.Wrapf(syscall.EINVAL, "lock ID %d is too large - max lock size is %d", + id, m.locks.GetMaxLocks()-1) + } + return lock, nil } |