Access attach command conditionaly
If cache is restored after upgrade, NULL is passed instead of `struct kcas_start_cache`. This leads to null pointer dereference. To prevent null pointer dereference, `struct kcas_start_cache` is tested before each use Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
975ec6f32a
commit
c71b5fcbd3
@ -1836,7 +1836,7 @@ static void init_instance_complete(struct _cache_mngt_attach_context *ctx,
|
||||
/* Set other back information */
|
||||
name = block_dev_get_elevator_name(
|
||||
casdsk_disk_get_queue(bd_cache_obj->dsk));
|
||||
if (name)
|
||||
if (name && ctx->cmd)
|
||||
strlcpy(ctx->cmd->cache_elevator,
|
||||
name, MAX_ELEVATOR_NAME);
|
||||
}
|
||||
@ -1893,7 +1893,7 @@ static void _cache_mngt_start_complete(ocf_cache_t cache, void *priv, int error)
|
||||
int caller_status = _cache_mngt_async_callee_peek_result(&ctx->async);
|
||||
|
||||
if (caller_status || error) {
|
||||
if (error == -OCF_ERR_NO_FREE_RAM) {
|
||||
if (error == -OCF_ERR_NO_FREE_RAM && ctx->cmd) {
|
||||
ocf_mngt_get_ram_needed(cache, ctx->device_cfg,
|
||||
&ctx->cmd->min_free_ram);
|
||||
} else if (caller_status == -KCAS_ERR_WAITING_INTERRUPTED) {
|
||||
|
Loading…
Reference in New Issue
Block a user