mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rbd: fixed all potential crashing when decoding volume ID failed
Signed-off-by: HF <crazytaxii666@gmail.com>
This commit is contained in:
@ -1082,7 +1082,11 @@ func (cs *ControllerServer) CreateSnapshot(
|
||||
|
||||
// Fetch source volume information
|
||||
rbdVol, err := GenVolFromVolID(ctx, req.GetSourceVolumeId(), cr, req.GetSecrets())
|
||||
defer rbdVol.Destroy()
|
||||
defer func() {
|
||||
if rbdVol != nil {
|
||||
rbdVol.Destroy()
|
||||
}
|
||||
}()
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, ErrImageNotFound):
|
||||
|
Reference in New Issue
Block a user