summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-12-04 12:23:08 -0800
committerShentubot <shentubot@google.com>2018-12-04 12:24:55 -0800
commit54dd0d0dc5ee452890628c537e6ebd1ac8c9d699 (patch)
treef1d3d0f0f8ddfd1f95035e3c32aebbf1b7b8985b /pkg
parentc3dd68cea7427af4dfdfbac4f292d0dfcdea465c (diff)
Fix data race caused by unlocked call of Dirent.descendantOf.
PiperOrigin-RevId: 224025363 Change-Id: I98864403c779832e9e1436f7d3c3f6fb2fba9904
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/fs/dirent.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/fs/dirent.go b/pkg/sentry/fs/dirent.go
index 2c01485a8..4c0d1b7ef 100644
--- a/pkg/sentry/fs/dirent.go
+++ b/pkg/sentry/fs/dirent.go
@@ -840,6 +840,10 @@ func (d *Dirent) getDotAttrs(root *Dirent) (DentAttr, DentAttr) {
InodeID: sattr.InodeID,
}
+ // Hold d.mu while we call d.descendantOf.
+ d.mu.Lock()
+ defer d.mu.Unlock()
+
// Get '..'.
if !d.IsRoot() && d.descendantOf(root) {
// Dirent is a descendant of the root. Get its parent's attrs.