Skip to content

Commit

Permalink
rbd: fixed csi-rbdplugin crashes when decoding volume ID failed
Browse files Browse the repository at this point in the history
Signed-off-by: HF <crazytaxii666@gmail.com>
  • Loading branch information
crazytaxii authored and nixpanic committed Sep 5, 2023
1 parent b3ef867 commit 4983792
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,11 @@ func (cs *ControllerServer) DeleteVolume(
}

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

0 comments on commit 4983792

Please sign in to comment.