This is a note to let you know that I've just added the patch titled media: cedrus: Fix watchdog race condition to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-cedrus-fix-watchdog-race-condition.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From fe8b81fde69acfcbb5af9e85328e5b9549999fdb Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx> Date: Thu, 18 Aug 2022 22:33:06 +0200 Subject: media: cedrus: Fix watchdog race condition From: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx> commit fe8b81fde69acfcbb5af9e85328e5b9549999fdb upstream. The watchdog needs to be scheduled before we trigger the decode operation, otherwise there is a risk that the decoder IRQ will be called before we have schedule the watchdog. As a side effect, the watchdog would never be cancelled and its function would be called at an inappropriate time. This was observed while running Fluster with GStreamer as a backend. Some programming error would cause the decoder IRQ to be call very quickly after the trigger. Later calls into the driver would deadlock due to the unbalanced state. Cc: stable@xxxxxxxxxxxxxxx Fixes: 7c38a551bda1 ("media: cedrus: Add watchdog for job completion") Signed-off-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@xxxxxxxxxxx> Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -106,11 +106,11 @@ void cedrus_device_run(void *priv) /* Trigger decoding if setup went well, bail out otherwise. */ if (!error) { - dev->dec_ops[ctx->current_codec]->trigger(ctx); - /* Start the watchdog timer. */ schedule_delayed_work(&dev->watchdog_work, msecs_to_jiffies(2000)); + + dev->dec_ops[ctx->current_codec]->trigger(ctx); } else { v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, Patches currently in stable-queue which might be from nicolas.dufresne@xxxxxxxxxxxxx are queue-6.0/media-cedrus-set-the-platform-driver-data-earlier.patch queue-6.0/media-cedrus-fix-watchdog-race-condition.patch queue-6.0/media-cedrus-fix-endless-loop-in-cedrus_h265_skip_bits.patch