diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-12 20:46:53 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-12 20:46:53 +0000 |
commit | a57b790485c484d5fdcbcc681607d3dca47b910b (patch) | |
tree | 9e5828061fb9f0f2c0fec545647ba43afccae918 /pkg/sentry/fs/tmpfs | |
parent | 0f45ab4d50c5631d6a14a3c415e7c7bbae97d2b8 (diff) | |
parent | 7b691ab73c7a3534e3351a5ca55a82e73ec63f75 (diff) |
Merge release-20200422.0-291-g7b691ab (automated)
Diffstat (limited to 'pkg/sentry/fs/tmpfs')
-rw-r--r-- | pkg/sentry/fs/tmpfs/tmpfs.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pkg/sentry/fs/tmpfs/tmpfs.go b/pkg/sentry/fs/tmpfs/tmpfs.go index 3c2b583ae..b095312fe 100644 --- a/pkg/sentry/fs/tmpfs/tmpfs.go +++ b/pkg/sentry/fs/tmpfs/tmpfs.go @@ -39,14 +39,13 @@ var fsInfo = fs.Info{ // rename implements fs.InodeOperations.Rename for tmpfs nodes. func rename(ctx context.Context, oldParent *fs.Inode, oldName string, newParent *fs.Inode, newName string, replacement bool) error { - op, ok := oldParent.InodeOperations.(*Dir) - if !ok { - return syserror.EXDEV - } - np, ok := newParent.InodeOperations.(*Dir) - if !ok { + // Don't allow renames across different mounts. + if newParent.MountSource != oldParent.MountSource { return syserror.EXDEV } + + op := oldParent.InodeOperations.(*Dir) + np := newParent.InodeOperations.(*Dir) return ramfs.Rename(ctx, op.ramfsDir, oldName, np.ramfsDir, newName, replacement) } |