]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: iris: gen2: Add sanity check for session stop
authorDikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Mon, 29 Dec 2025 06:31:24 +0000 (12:01 +0530)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 20 Jan 2026 13:00:12 +0000 (14:00 +0100)
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.

Add a NULL check for inst_hfi_gen2->packet before sendling STOP packet
to firmware to fix that.

Fixes: 11712ce70f8e ("media: iris: implement vb2 streaming ops")
Signed-off-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c

index b492d9dfddd3c57c5f8e590133391588f93dd01f..c75c8b9398a20dca32a244e0e2ff03b5bed6ccd2 100644 (file)
@@ -1036,6 +1036,9 @@ static int iris_hfi_gen2_session_stop(struct iris_inst *inst, u32 plane)
        struct iris_inst_hfi_gen2 *inst_hfi_gen2 = to_iris_inst_hfi_gen2(inst);
        int ret = 0;
 
+       if (!inst_hfi_gen2->packet)
+               return -EINVAL;
+
        reinit_completion(&inst->completion);
 
        iris_hfi_gen2_packet_session_command(inst,