diff options
Diffstat (limited to 'pkg/sentry/fsimpl/gofer/fstree.go')
-rw-r--r-- | pkg/sentry/fsimpl/gofer/fstree.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/gofer/fstree.go b/pkg/sentry/fsimpl/gofer/fstree.go index 9ef0dd8c8..507dc82e6 100644 --- a/pkg/sentry/fsimpl/gofer/fstree.go +++ b/pkg/sentry/fsimpl/gofer/fstree.go @@ -8,7 +8,7 @@ import ( // IsAncestorDentry returns true if d is an ancestor of d2; that is, d is // either d2's parent or an ancestor of d2's parent. func genericIsAncestorDentry(d, d2 *dentry) bool { - for { + for d2 != nil { if d2.parent == d { return true } @@ -17,6 +17,7 @@ func genericIsAncestorDentry(d, d2 *dentry) bool { } d2 = d2.parent } + return false } // ParentOrSelf returns d.parent. If d.parent is nil, ParentOrSelf returns d. |