Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b57c8ca2 authored by Sowmya Pandiri's avatar Sowmya Pandiri Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Do not enable power if close is called during SYS_ERROR handling



If msm_vidc_close() is called while sys error handling is in progress
and before firmware gets loaded, then power_on() will be called in
venus HFI. As the instance and core are still in invalid state,
we end up calling __unvote_buses() that accesses NULL device pointer
causing kernel panic. This change will address the race condition.

Change-Id: If3d815c12f425bd7b4262a43f1c9741f46a8b62f
CRs-Fixed: 857826
Signed-off-by: default avatarSowmya Pandiri <spandiri@codeaurora.org>
parent 4c47f344
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -4655,9 +4655,10 @@ void msm_comm_smem_free(struct msm_vidc_inst *inst, struct msm_smem *mem)
		return;
	}
	mutex_lock(&inst->core->lock);
	if (inst->state != MSM_VIDC_CORE_INVALID) {
		if (power_on_for_smem(inst))
			goto err_power_on;

	}
	msm_smem_free(inst->mem_client, mem);
err_power_on:
	mutex_unlock(&inst->core->lock);
@@ -4683,6 +4684,13 @@ struct msm_smem *msm_comm_smem_user_to_kernel(struct msm_vidc_inst *inst,
		dprintk(VIDC_ERR, "%s: invalid inst: %p\n", __func__, inst);
		return NULL;
	}

	if (inst->state == MSM_VIDC_CORE_INVALID) {
		dprintk(VIDC_ERR, "Core in Invalid state, returning from %s\n",
			__func__);
		return NULL;
	}

	mutex_lock(&inst->core->lock);
	if (power_on_for_smem(inst))
		goto err_power_on;