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

Commit 75d5273d authored by huiy's avatar huiy
Browse files

msm: vidc: Add NULL pointer check before deiniting controls



Add NULL pointer check in deinit function, and return -EINVAL
when NULL pointer is found.
Without this change, accidentally, msm_venc_ctrl_deinit() will be called
with a null pointer parameter, which will cause kernel panic.

Change-Id: I80bb6c271dcd3277ddce5332c5f42328ca376128
CRs-Fixed: 652365
Signed-off-by: default avatarhuiy <huiyQuic@codeaurora.org>
parent 1cd71605
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -2225,6 +2225,11 @@ int msm_vdec_ctrl_init(struct msm_vidc_inst *inst)

int msm_vdec_ctrl_deinit(struct msm_vidc_inst *inst)
{
	if (!inst) {
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
		return -EINVAL;
	}

	kfree(inst->ctrls);
	kfree(inst->cluster);
	v4l2_ctrl_handler_free(&inst->ctrl_handler);
+5 −0
Original line number Diff line number Diff line
@@ -3338,6 +3338,11 @@ int msm_venc_ctrl_init(struct msm_vidc_inst *inst)

int msm_venc_ctrl_deinit(struct msm_vidc_inst *inst)
{
	if (!inst) {
		dprintk(VIDC_ERR, "%s invalid parameters\n", __func__);
		return -EINVAL;
	}

	kfree(inst->ctrls);
	kfree(inst->cluster);
	v4l2_ctrl_handler_free(&inst->ctrl_handler);