diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2018-12-04 12:23:08 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-04 12:24:55 -0800 |
commit | 54dd0d0dc5ee452890628c537e6ebd1ac8c9d699 (patch) | |
tree | f1d3d0f0f8ddfd1f95035e3c32aebbf1b7b8985b /pkg/sentry/fs/dirent.go | |
parent | c3dd68cea7427af4dfdfbac4f292d0dfcdea465c (diff) |
Fix data race caused by unlocked call of Dirent.descendantOf.
PiperOrigin-RevId: 224025363
Change-Id: I98864403c779832e9e1436f7d3c3f6fb2fba9904
Diffstat (limited to 'pkg/sentry/fs/dirent.go')
-rw-r--r-- | pkg/sentry/fs/dirent.go | 4 |
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. |