Put cache after doing pipeline_destroy

Cache is used during pipeline_destroy which means that
doing put_cache before destroying pipeline may result in
accessing memory that was freed.

Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
This commit is contained in:
Vitaliy Mysak 2019-03-26 19:07:22 +00:00
parent 6ac6081b25
commit 2f2f004867

View File

@ -2068,11 +2068,8 @@ static void ocf_mngt_cache_stop_finish(ocf_pipeline_t pipeline,
cache->valid_ocf_cache_device_t = 0;
/* Remove cache from the list */
list_del(&cache->list);
/* Finally release cache instance */
ocf_mngt_cache_put(cache);
env_mutex_unlock(&ctx->lock);
if (context->error == -OCF_ERR_WRITE_CACHE) {
ocf_log(ctx, log_warn, "Stopped cache %s with errors\n",
context->cache_name);
@ -2087,6 +2084,9 @@ static void ocf_mngt_cache_stop_finish(ocf_pipeline_t pipeline,
context->cmpl(cache, context->priv, context->error);
ocf_pipeline_destroy(context->pipeline);
/* Finally release cache instance */
ocf_mngt_cache_put(cache);
}
struct ocf_pipeline_properties ocf_mngt_cache_stop_pipeline_properties = {