[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
This commit is contained in:
Ayush Ranjan
2020-09-08 14:42:39 -07:00
committed by gVisor bot
parent c8f1ce288d
commit 682c0edcdc
+2
View File
@@ -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