mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user