summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2020-09-08 14:40:57 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-08 14:42:39 -0700
commit682c0edcdcdfbf26be5d0d6efa2319f6f5259df2 (patch)
treeead51fea0191ebfcb958efa4ee57dd64b268b705 /pkg
parentc8f1ce288dd4d600ec191ef6cefcb02e2d6599ab (diff)
[vfs] overlayfs: decref VD when not using it.
overlay/filesystem.go:lookupLocked() did not DecRef the VD on some error paths when it would not end up saving or using the VD. PiperOrigin-RevId: 330589742
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/fsimpl/overlay/filesystem.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/overlay/filesystem.go b/pkg/sentry/fsimpl/overlay/filesystem.go
index 87afeeaf3..b530851c5 100644
--- a/pkg/sentry/fsimpl/overlay/filesystem.go
+++ b/pkg/sentry/fsimpl/overlay/filesystem.go
@@ -211,6 +211,7 @@ func (fs *filesystem) lookupLocked(ctx context.Context, parent *dentry, name str
lookupErr = err
return false
}
+ defer childVD.DecRef(ctx)
mask := uint32(linux.STATX_TYPE)
if !existsOnAnyLayer {
@@ -249,6 +250,7 @@ func (fs *filesystem) lookupLocked(ctx context.Context, parent *dentry, name str
}
// Update child to include this layer.
+ childVD.IncRef()
if isUpper {
child.upperVD = childVD
child.copiedUp = 1