From a7f70687a97943a4f1ae7301541b5ec1a6307424 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Thu, 9 Jun 2022 10:54:06 +0200 Subject: [PATCH] fix deinitialization of moved composite volume After moving from a volume, it's priv is assigned to the new owner. Destroying the volume after moving from it must not attempt to use the priv, especially not to attempt to deinit member volumes in case of composite volume. Signed-off-by: Adam Rutkowski --- src/ocf_composite_volume.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ocf_composite_volume.c b/src/ocf_composite_volume.c index d1530ec..a6bf91f 100644 --- a/src/ocf_composite_volume.c +++ b/src/ocf_composite_volume.c @@ -152,6 +152,11 @@ static void ocf_composite_volume_on_deinit(ocf_volume_t cvolume) struct ocf_composite_volume *composite = ocf_volume_get_priv(cvolume); int i; + /* priv can be NULL if this volume had been moved from. In this case + * it's the owner responsibility to deinit member volumes. */ + if (!composite) + return; + for (i = 0; i < composite->members_cnt; i++) ocf_volume_deinit(&composite->member[i].volume); }