summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/device
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/device')
-rw-r--r--pkg/sentry/device/device.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/sentry/device/device.go b/pkg/sentry/device/device.go
index a5514c72f..21fee8f8a 100644
--- a/pkg/sentry/device/device.go
+++ b/pkg/sentry/device/device.go
@@ -183,6 +183,14 @@ func (m *MultiDevice) Load(key MultiDeviceKey, value uint64) bool {
m.rcache = make(map[uint64]MultiDeviceKey)
}
+ if val, exists := m.cache[key]; exists && val != value {
+ return false
+ }
+ if k, exists := m.rcache[value]; exists && k != key {
+ // Should never happen.
+ panic("MultiDevice's caches are inconsistent")
+ }
+
// Cache value at key.
m.cache[key] = value