Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Missing error check for os.Stat call during volume publish #1014

Closed
gallacher opened this issue Oct 17, 2023 · 1 comment
Closed

[BUG]: Missing error check for os.Stat call during volume publish #1014

gallacher opened this issue Oct 17, 2023 · 1 comment
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

Comments

@gallacher
Copy link
Contributor

gallacher commented Oct 17, 2023

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

@gallacher gallacher added needs-triage Issue requires triage. type/bug Something isn't working. This is the default label associated with a bug issue. area/csi-powerflex Issue pertains to the CSI Driver for Dell EMC PowerFlex area/csi-powerscale Issue pertains to the CSI Driver for Dell EMC PowerScale area/csi-unity Issue pertains to the CSI Driver for Dell EMC Unity area/csi-powermax Issue pertains to the CSI Driver for Dell EMC PowerMax and removed needs-triage Issue requires triage. labels Oct 17, 2023
@gallacher gallacher added this to the v1.9.0 milestone Oct 17, 2023
@gallacher
Copy link
Contributor Author

gallacher commented Oct 17, 2023

link: 18050, 18049, 18051, 18048, 18052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

1 participant