The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: syzbot <syzbot+051024d603432b4ab395@syzkaller.appspotmail.com>
To: birenpandya@gmail.com
Cc: birenpandya@gmail.com, linux-kernel@vger.kernel.org,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] media: cec: cancel delayed work before freeing an interrupted transmit
Date: Sat, 20 Jun 2026 11:38:49 -0700	[thread overview]
Message-ID: <6a36de39.c19584c1.44bb3.0003.GAE@google.com> (raw)
In-Reply-To: <20260620183844.48655-2-birenpandya@gmail.com>

> If wait_for_completion_killable() is interrupted in cec_transmit_msg_fh(),
> the previous cancel_delayed_work_sync() could race with the CEC kthread,
> which might re-arm the timeout *after* the cancel completes. This leads
> to freeing active delayed_work and an ODEBUG warning.
>
> Fix this by cancelling the delayed work only after removing the data from
> the transmit and wait queues, ensuring the kthread cannot re-arm it. Drop
> adap->lock around the synchronous cancel to avoid deadlocking with
> cec_wait_timeout().
>
> Fixes: 490d84f6d73c ("media: cec: forgot to cancel delayed work")
> Reported-by: syzbot+051024d603432b4ab395@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=051024d603432b4ab395
> Cc: stable@vger.kernel.org
> Signed-off-by: Biren Pandya <birenpandya@gmail.com>
> ---
> #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

This crash does not have a reproducer. I cannot test it.

>  drivers/media/cec/core/cec-adap.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
> index 8f7244ac1d43..50bd8bbeb5a5 100644
> --- a/drivers/media/cec/core/cec-adap.c
> +++ b/drivers/media/cec/core/cec-adap.c
> @@ -965,7 +965,6 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
>  	 */
>  	mutex_unlock(&adap->lock);
>  	err = wait_for_completion_killable(&data->c);
> -	cancel_delayed_work_sync(&data->work);
>  	mutex_lock(&adap->lock);
>  
>  	if (err)
> @@ -985,6 +984,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
>  		list_del(&data->list);
>  	if (WARN_ON(!list_empty(&data->xfer_list)))
>  		list_del(&data->xfer_list);
> +
> +	if (!cancel_delayed_work(&data->work)) {
> +		mutex_unlock(&adap->lock);
> +		cancel_delayed_work_sync(&data->work);
> +		mutex_lock(&adap->lock);
> +	}
> +
>  	kfree(data);
>  	return 0;
>  }
> -- 
> 2.50.1

       reply	other threads:[~2026-06-20 18:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260620183844.48655-2-birenpandya@gmail.com>
2026-06-20 18:38 ` syzbot [this message]
2026-06-20 19:15 [PATCH] media: cec: cancel delayed work before freeing an interrupted transmit Biren Pandya
2026-06-20 23:34 ` Hillf Danton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a36de39.c19584c1.44bb3.0003.GAE@google.com \
    --to=syzbot+051024d603432b4ab395@syzkaller.appspotmail.com \
    --cc=birenpandya@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox