]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:09 +0000 (07:21 -0500)
[ Upstream commit 9aa8d63d09cfc44d879427cc5ba308012ca4ab8e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c

index 4ce71a14250832440099e4cf3835b4aedfb749e8..5f6e2c9407e67055a8545b5e5a3220fcc6f401be 100644 (file)
@@ -946,6 +946,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,