From 68cadd90f89984d0eedf94bdcbfc30321b68dae4 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Fri, 8 Apr 2022 13:37:01 +0200 Subject: [PATCH 1/5] Destroy volume if it couldn't be opened Signed-off-by: Michal Mielewczyk --- modules/cas_cache/volume/vol_blk_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/cas_cache/volume/vol_blk_utils.c b/modules/cas_cache/volume/vol_blk_utils.c index 3cb374821..79368c655 100644 --- a/modules/cas_cache/volume/vol_blk_utils.c +++ b/modules/cas_cache/volume/vol_blk_utils.c @@ -241,7 +241,9 @@ int cas_blk_open_volume_by_bdev(ocf_volume_t *vol, struct block_device *bdev) bdobj->btm_bd = bdev; bdobj->opened_by_bdev = true; - return ocf_volume_open(*vol, NULL); + ret = ocf_volume_open(*vol, NULL); + if (ret) + ocf_volume_destroy(*vol); err: return ret; From 531c7856bddcfc0af8dea2e0fbb18718dbc045b5 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Fri, 8 Apr 2022 15:30:15 +0200 Subject: [PATCH 2/5] Prevent uninitialized value Signed-off-by: Michal Mielewczyk --- modules/cas_cache/ocf_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/cas_cache/ocf_env.c b/modules/cas_cache/ocf_env.c index 33ff384b3..bdb66d221 100644 --- a/modules/cas_cache/ocf_env.c +++ b/modules/cas_cache/ocf_env.c @@ -43,7 +43,7 @@ struct _env_allocator_item { void *env_allocator_new(env_allocator *allocator) { struct _env_allocator_item *item = NULL; - int cpu; + int cpu = 0; if (allocator->rpool) item = cas_rpool_try_get(allocator->rpool, &cpu); From 5bcba78e7ff0f892a087c32671e43c3ba8ffc097 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Fri, 8 Apr 2022 16:10:47 +0200 Subject: [PATCH 3/5] Make sure classifier string is null terminated Signed-off-by: Adam Rutkowski --- modules/cas_cache/classifier.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/cas_cache/classifier.c b/modules/cas_cache/classifier.c index 70bbf9eaf..b946a847e 100644 --- a/modules/cas_cache/classifier.c +++ b/modules/cas_cache/classifier.c @@ -203,6 +203,10 @@ static int _cas_cls_string_ctr(struct cas_classifier *cls, CAS_CLS_MSG(KERN_ERR, "String specifier is empty\n"); return -EINVAL; } + if (len == MAX_STRING_SPECIFIER_LEN) { + CAS_CLS_MSG(KERN_ERR, "String specifier is too long\n"); + return -EINVAL; + } ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) From 3497b2c7288462be52a0b0771a940d9c664a845b Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Fri, 8 Apr 2022 16:40:31 +0200 Subject: [PATCH 4/5] Update OCF. Signed-off-by: Michal Mielewczyk --- ocf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocf b/ocf index a0bf8587a..99608c9a3 160000 --- a/ocf +++ b/ocf @@ -1 +1 @@ -Subproject commit a0bf8587a0a3652432dea827f2e8b1b3218a2010 +Subproject commit 99608c9a306e3e2a4f586eb097ae03d321b518ef From 8fae9e2476d5954721c4593773453abb812fef70 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Fri, 8 Apr 2022 17:16:04 +0200 Subject: [PATCH 5/5] Destroy exp obj workqueue properly Signed-off-by: Robert Baldyga --- modules/cas_cache/volume/vol_block_dev_top.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/cas_cache/volume/vol_block_dev_top.c b/modules/cas_cache/volume/vol_block_dev_top.c index 5ea79597f..7fb64b58e 100644 --- a/modules/cas_cache/volume/vol_block_dev_top.c +++ b/modules/cas_cache/volume/vol_block_dev_top.c @@ -742,8 +742,10 @@ static int kcas_core_stop_exported_object(ocf_core_t core, void *cntx) casdisk_functions.casdsk_exp_obj_get_gendisk(bvol->dsk)->disk_name); ret = casdisk_functions.casdsk_exp_obj_destroy(bvol->dsk); - if (!ret) + if (!ret) { bvol->expobj_valid = false; + destroy_workqueue(bvol->expobj_wq); + } } if (bvol->expobj_locked) {