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

csi-rbdplugin crashes when decoding volume ID(CSI identifier) failed #4098

Closed
crazytaxii opened this issue Sep 4, 2023 · 2 comments · Fixed by #4108
Closed

csi-rbdplugin crashes when decoding volume ID(CSI identifier) failed #4098

crazytaxii opened this issue Sep 4, 2023 · 2 comments · Fixed by #4108
Labels
bug Something isn't working component/rbd Issues related to RBD

Comments

@crazytaxii
Copy link
Contributor

crazytaxii commented Sep 4, 2023

Describe the bug

csi-rbdplugin will crash when decoding volume ID failed due to nil pointer

Environment details

  • Image/version of Ceph CSI driver : v3.6.2
  • Helm chart version :
  • Kernel version : 4.18.0
  • Mounter used for mounting PVC (for cephFS its fuse or kernel. for rbd its
    krbd or rbd-nbd) : krbd
  • Kubernetes cluster version : v1.27.2
  • Ceph cluster version : 16.2.13

problematic code:

	rbdVol, err := GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
	defer rbdVol.Destroy()
	if err != nil {
		return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
	}

defer should be placed under error processing

Tasks

Preview Give feedback
No tasks being tracked yet.
@Madhu-1
Copy link
Collaborator

Madhu-1 commented Sep 4, 2023

@crazytaxii Do you have any test cases or the steps to produce this panic?

@crazytaxii
Copy link
Contributor Author

the code itself is incorrect:

	rbdVol, err := GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
	defer rbdVol.Destroy()
	if err != nil {
		return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
	}

it should be:

	rbdVol, err := GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
	if err != nil {
		return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
	}
	defer rbdVol.Destroy()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants