Skip to content

Commit daa87ca

Browse files
cazoumchehab
authored andcommitted
media: rkvdec: Improve handling missing short/long term RPS
The values of ext_sps_st_rps and ext_sps_lt_rps in struct rkvdec_hevc_run are not initialized when the respective controls are not set by userspace. When this is the case, set them to NULL so the rkvdec_hevc_run_preamble function that parses controls does not access garbage data which leads to a panic on unaccessible memory. Fixes: c9a59dc ("media: rkvdec: Add HEVC support for the VDPU381 variant") Reported-by: Christian Hewitt <[email protected]> Suggested-by: Jonas Karlman <[email protected]> Signed-off-by: Detlev Casanova <[email protected]> Tested-by: Christian Hewitt <[email protected]> Reviewed-by: Nicolas Dufresne <[email protected]> Signed-off-by: Nicolas Dufresne <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent bef4f4a commit daa87ca

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/media/platform/rockchip/rkvdec/rkvdec-hevc-common.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,15 @@ void rkvdec_hevc_run_preamble(struct rkvdec_ctx *ctx,
500500
ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl,
501501
V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS);
502502
run->ext_sps_st_rps = ctrl ? ctrl->p_cur.p : NULL;
503+
} else {
504+
run->ext_sps_st_rps = NULL;
503505
}
504506
if (ctx->has_sps_lt_rps) {
505507
ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl,
506508
V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS);
507509
run->ext_sps_lt_rps = ctrl ? ctrl->p_cur.p : NULL;
510+
} else {
511+
run->ext_sps_lt_rps = NULL;
508512
}
509513

510514
rkvdec_run_preamble(ctx, &run->base);

0 commit comments

Comments
 (0)