Skip to content

Commit

Permalink
media: venus: vdec: Init registered list unconditionally
Browse files Browse the repository at this point in the history
[ Upstream commit bc3d870 ]

Presently the list initialization is done only in
dynamic-resolution-change state, which leads to list corruptions
and use-after-free. Init list_head unconditionally in
vdec_stop_capture called by vb2 stop_streaming without takeing
into account current codec state.

Signed-off-by: Stanimir Varbanov <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Stanimir Varbanov authored and gregkh committed Oct 1, 2020
1 parent fa7c336 commit bd60439
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/media/platform/qcom/venus/vdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,13 +987,14 @@ static int vdec_stop_capture(struct venus_inst *inst)
ret = hfi_session_flush(inst, HFI_FLUSH_OUTPUT);
vdec_cancel_dst_buffers(inst);
inst->codec_state = VENUS_DEC_STATE_CAPTURE_SETUP;
INIT_LIST_HEAD(&inst->registeredbufs);
venus_helper_free_dpb_bufs(inst);
break;
default:
return 0;
break;
}

INIT_LIST_HEAD(&inst->registeredbufs);

return ret;
}

Expand Down

0 comments on commit bd60439

Please sign in to comment.