mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-21 00:54:52 -04:00
media: iris: Add sanity check for stop streaming
Add sanity check in iris_vb2_stop_streaming. If inst->state is
already IRIS_INST_ERROR, we should skip the stream_off operation
because it would still send packets to the firmware.
In iris_kill_session, inst->state is set to IRIS_INST_ERROR and
session_close is executed, which will kfree(inst_hfi_gen2->packet).
If stop_streaming is called afterward, it will cause a crash.
Fixes: 11712ce70f ("media: iris: implement vb2 streaming ops")
Cc: stable@vger.kernel.org
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
[bod: remove qcom from patch title]
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
aec75e355c
commit
ad699fa78b
@@ -231,6 +231,8 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
|
||||
return;
|
||||
|
||||
mutex_lock(&inst->lock);
|
||||
if (inst->state == IRIS_INST_ERROR)
|
||||
goto exit;
|
||||
|
||||
if (!V4L2_TYPE_IS_OUTPUT(q->type) &&
|
||||
!V4L2_TYPE_IS_CAPTURE(q->type))
|
||||
@@ -241,10 +243,10 @@ void iris_vb2_stop_streaming(struct vb2_queue *q)
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
iris_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR);
|
||||
iris_inst_change_state(inst, IRIS_INST_ERROR);
|
||||
|
||||
}
|
||||
mutex_unlock(&inst->lock);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user