summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/task_resources.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-06-28 16:10:17 -0700
committerShentubot <shentubot@google.com>2018-06-28 16:11:19 -0700
commitf93bd2cbe66817c300114630bb52702466e52129 (patch)
tree31dcae4c3ea588c30468457adf1a144ee61862e9 /pkg/sentry/kernel/task_resources.go
parent16d37973ebc8f36ef613c0885879648cceaf1c45 (diff)
Hold t.mu while calling t.FSContext().
PiperOrigin-RevId: 202562686 Change-Id: I0f5be7cc9098e86fa31d016251c127cb91084b05
Diffstat (limited to 'pkg/sentry/kernel/task_resources.go')
-rw-r--r--pkg/sentry/kernel/task_resources.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/task_resources.go b/pkg/sentry/kernel/task_resources.go
index 0389989e8..4ca25664a 100644
--- a/pkg/sentry/kernel/task_resources.go
+++ b/pkg/sentry/kernel/task_resources.go
@@ -123,6 +123,8 @@ func (t *Task) IsChrooted() bool {
realRoot := t.k.mounts.Root()
defer realRoot.DecRef()
root := t.tr.FSContext.RootDirectory()
- defer root.DecRef()
+ if root != nil {
+ defer root.DecRef()
+ }
return root != realRoot
}