Fix for null pointer dereference bug

Null pointer dereference occurs when terminating cache is standby detached state.
This fixes this problem.

Fixes #1235

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
This commit is contained in:
Krzysztof Majzerowicz-Jaszcz
2022-06-24 05:22:31 -04:00
parent 85cbeb997c
commit 2739d83bec
2 changed files with 7 additions and 2 deletions

View File

@@ -571,9 +571,14 @@ end:
static int kcas_volume_destroy_exported_object(ocf_volume_t volume)
{
struct bd_object *bvol = bd_object(volume);
struct bd_object *bvol;
int result;
BUG_ON(!volume);
bvol = bd_object(volume);
BUG_ON(!bvol);
if (!bvol->expobj_valid)
return 0;