diff options
Diffstat (limited to 'pkg/sentry/fsimpl/kernfs')
-rw-r--r-- | pkg/sentry/fsimpl/kernfs/fstree.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/sentry/fsimpl/kernfs/fstree.go b/pkg/sentry/fsimpl/kernfs/fstree.go index 4c4033462..ce86d7919 100644 --- a/pkg/sentry/fsimpl/kernfs/fstree.go +++ b/pkg/sentry/fsimpl/kernfs/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. |