summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/fsutil
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2020-03-02 10:05:52 -0800
committergVisor bot <gvisor-bot@google.com>2020-03-02 10:07:13 -0800
commit62bd3ca8a37543c060292ca86669e537b9ebf36d (patch)
treef70d6f2058fbc6c35e35e6cc182d04f284c3793f /pkg/sentry/fs/fsutil
parent3d9ddeb339ce41f82717643dce92b24f3ae0cf41 (diff)
Take write lock when removing xattr
PiperOrigin-RevId: 298380654
Diffstat (limited to 'pkg/sentry/fs/fsutil')
-rw-r--r--pkg/sentry/fs/fsutil/inode.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/fs/fsutil/inode.go b/pkg/sentry/fs/fsutil/inode.go
index daecc4ffe..1922ff08c 100644
--- a/pkg/sentry/fs/fsutil/inode.go
+++ b/pkg/sentry/fs/fsutil/inode.go
@@ -259,8 +259,8 @@ func (i *InodeSimpleExtendedAttributes) ListXattr(context.Context, *fs.Inode, ui
// RemoveXattr implements fs.InodeOperations.RemoveXattr.
func (i *InodeSimpleExtendedAttributes) RemoveXattr(_ context.Context, _ *fs.Inode, name string) error {
- i.mu.RLock()
- defer i.mu.RUnlock()
+ i.mu.Lock()
+ defer i.mu.Unlock()
if _, ok := i.xattrs[name]; ok {
delete(i.xattrs, name)
return nil