diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-07 07:49:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 07:49:49 -0800 |
commit | d0b166023f0d909080f733a40a3f0606c9ad7509 (patch) | |
tree | c5507f5c7a248252a819cdfa765e767c9faf531e /libpod/lock/shm_lock_manager_linux.go | |
parent | a219431a317a2b6d9647ce81b7c845345e51b7da (diff) | |
parent | eba89259a5938f047d78b74c5bbbc908f8ff4be8 (diff) | |
download | podman-d0b166023f0d909080f733a40a3f0606c9ad7509.tar.gz podman-d0b166023f0d909080f733a40a3f0606c9ad7509.tar.bz2 podman-d0b166023f0d909080f733a40a3f0606c9ad7509.zip |
Merge pull request #2083 from mheon/shm_locking_fixes
Address lingering review comments from SHM locking PR
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 } |