Skip to content

Commit 62d7772

Browse files
committed
Check FileInfo against nil during walk of container dir path
1 parent efe159e commit 62d7772

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/volume/util/subpath/subpath_linux.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ func doCleanSubPaths(mounter mount.Interface, podDir string, volumeName string)
240240
return err
241241
}
242242

243-
if info.IsDir() {
243+
// We need to check that info is not nil. This may happen when the incoming err is not nil due to stale mounts or permission errors.
244+
if info != nil && info.IsDir() {
244245
// skip subdirs of the volume: it only matters the first level to unmount, otherwise it would try to unmount subdir of the volume
245246
return filepath.SkipDir
246247
}

0 commit comments

Comments
 (0)