[BUG]: Missing error check for os.Stat call during volume publish #1014
Labels
area/csi-powerflex
Issue pertains to the CSI Driver for Dell EMC PowerFlex
area/csi-powermax
Issue pertains to the CSI Driver for Dell EMC PowerMax
area/csi-powerscale
Issue pertains to the CSI Driver for Dell EMC PowerScale
area/csi-powerstore
Issue pertains to the CSI Driver for Dell EMC PowerStore
area/csi-unity
Issue pertains to the CSI Driver for Dell EMC Unity
type/bug
Something isn't working. This is the default label associated with a bug issue.
Milestone
Bug Description
mount.go need to handle all errors for os.Stat call to avoid null pointer panic.
func mkdir(path string) (bool, error) {
st, err := os.Stat(path)
if os.IsNotExist(err) {
/* #nosec G301 */
if err := os.Mkdir(path, 0755); err != nil {
Log.WithField("dir", path).WithError(
err).Error("Unable to create dir")
return false, err
}
Log.WithField("path", path).Debug("created directory")
return true, nil
}
if !st.IsDir() {
return false, fmt.Errorf("existing path is not a directory")
}
return false, nil
}
Logs
N/A
Screenshots
No response
Additional Environment Information
No response
Steps to Reproduce
N/A
Expected Behavior
Fail gracefully
CSM Driver(s)
PowerFlex, PowerScale, PowerMax, Unity, PowerStore
Installation Type
No response
Container Storage Modules Enabled
No response
Container Orchestrator
N/A
Operating System
N/A
The text was updated successfully, but these errors were encountered: