[PATCH v6 5/6] media: platform: Add Raspberry Pi HEVC decoder driver
John Cox
jc at kynesim.co.uk
Sun Nov 15 02:33:28 PST 2026
Hi Andre
>Hi Dave, hi John,
>
>(Sorry for not threading this properly, my mail client cannot set
>In-Reply-To. This refers to [PATCH v6 5/6], posted 2026-03-04:
>https://www.google.com/url?q=https://lore.kernel.org/linux-media/20260304-media-rpi-hevc-dec-v6-0-93868ae6dff8@raspberrypi.com/&source=gmail&ust=1794798867626000&sa=E
>)
>
>I believe there is a regression in v6 in dec_env_init() in
>hevc_d_h265.c:
>
>ctx->dec_pool = kmalloc_objs(*ctx->dec_pool, HEVC_D_DEC_ENV_COUNT,
>GFP_KERNEL);
>
>The decode environments are not zeroed any more. hevc_d_h265_setup()
>sets de->frame_aux, but de->col_aux only when the picture has a
>collocated reference. For the first pictures of a context (an IDR has
>none) col_aux therefore holds stale slab contents. phase2_claimed()
>dereferences de->col_aux->col.addr and dec_env_delete() drops a
>reference through it, which oopses in the decoder interrupt handler
>(phase2_claimed+0x18c, "Fatal exception in interrupt").
>
>The downstream tree has always zeroed this allocation (kzalloc in
>rpi-6.12.y, kcalloc in rpi-6.18.y), so this looks like a slip when
>converting to the new allocation helpers in v5 ("Switched to
>kzalloc_obj/kzalloc_objs as checkpatch now checks that").
>
>Suggested fix:
>
>- ctx->dec_pool = kmalloc_objs(*ctx->dec_pool, HEVC_D_DEC_ENV_COUNT,
>+ ctx->dec_pool = kzalloc_objs(*ctx->dec_pool, HEVC_D_DEC_ENV_COUNT,
>GFP_KERNEL);
>
>Tested on a Raspberry Pi 4 (BCM2711) with Linux 6.18.63 plus the v6
>series (with a small backport to build on 6.18), decoding 1080p25 and
>1080p60 Main and Main10 HEVC streams: before the change an oops in
>about every second run (found via netconsole), after the change more
>than 20 consecutive runs without errors.
You are almost certainly correct. Thanks for the patch.
John Cox
>Signed-off-by: André Fritz <logic1208 at gmail.com>
>
>Thanks for the driver,
>André Fritz
More information about the linux-rpi-kernel
mailing list