Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hermes Wu" <Hermes.wu@ite.com.tw>
Cc: devicetree@vger.kernel.org, linux-sound@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v2 6/9] media: i2c: it6625: add I2S audio capture DAI
Date: Tue, 24 Nov 2026 03:18:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-230449@kernel.org> (raw)
In-Reply-To: <20261124-upstream-it6625-alsa-i2s-v2-6-a154685f6989@ite.com.tw>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: i2c: it6625: work teardown after subdev cleanup in
  it6625_probe()
--

commit 853245ce8c11b8ab4cad5a6167d0cdd74d9412b2
Author: Hermes Wu <Hermes.wu@ite.com.tw>

media: i2c: it6625: add I2S audio capture DAI

This commit registers an ASoC component with an I2S capture DAI for the
IT6625/IT6626 HDMI bridge when #sound-dai-cells is present in device tree,
and updates audio controls and capture state on status changes and
periodic refreshes.

> diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
> index 6ff5a5574b379..4a6ab00f04013 100644
> --- a/drivers/media/i2c/it6625.c
> +++ b/drivers/media/i2c/it6625.c

[ ... ]

> @@ -2434,6 +3001,13 @@ static int it6625_probe(struct i2c_client *client)
>  		goto err_clean_debugfs;
>  	}
>  
> +	/* may bind a waiting sound card, so everything must be set up */
> +	err = it6625_audio_register(it6625);
> +	if (err) {
> +		v4l2_async_unregister_subdev(sd);
> +		goto err_clean_debugfs;
> +	}
> +
>  	if (client->irq)
>  		enable_irq(client->irq);
>  	else
> @@ -2442,6 +3016,12 @@ static int it6625_probe(struct i2c_client *client)
>  	return 0;
>  
>  err_clean_debugfs:
> +	/*
> +	 * Events dispatched by the probe control update or a debugfs reader
> +	 * may have queued it. Disable rather than cancel it: a reader still
> +	 * running until the debugfs removal below must not queue it again.
> +	 */
> +	disable_delayed_work_sync(&it6625->audio_refresh_work);
>  	v4l2_debugfs_if_free(it6625->infoframes);
>  	debugfs_remove_recursive(it6625->debugfs_dir);
>  	cec_unregister_adapter(it6625->cec_adap);

[Severity: Medium]
Can polling_work or hpd_delayed_work run after it6625->cec_adap and
it6625->hdl are torn down when it6625_audio_register() fails?

Before this patch, v4l2_async_register_subdev() was the last fallible step
in it6625_probe(), so no subdev callback could have queued polling_work or
hpd_delayed_work on the probe error path.  With it6625_audio_register()
placed after v4l2_async_register_subdev(), a bound bridge can invoke
subdev callbacks such as it6625_isr() (which schedules polling_work) or
it6625_s_edid() (which schedules hpd_delayed_work) before
v4l2_async_unregister_subdev() runs:

CPU0                              CPU1 (kworker)
it6625_probe()
  v4l2_async_register_subdev(sd)
  /* subdev callback: it6625_isr() */
    schedule_work(&it6625->polling_work)
  it6625_audio_register() -> fails
  v4l2_async_unregister_subdev(sd)
  goto err_clean_debugfs
  cec_unregister_adapter(it6625->cec_adap)
  v4l2_subdev_cleanup(sd)
  v4l2_ctrl_handler_free(&it6625->hdl)
                                  it6625_polling_work()
                                    ...
                                      it6625_v4l2_sd_ctrl_update()
                                        <-- use-after-free on controls
  cancel_work_sync(&it6625->polling_work)

Canceling polling_work and hpd_delayed_work after
v4l2_async_unregister_subdev() (or at err_clean_debugfs, matching the
teardown order in it6625_remove()) would drain them before the CEC adapter
and V4L2 controls are freed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-upstream-it6625-alsa-i2s-v2-0-a154685f6989@ite.com.tw?part=6

  reply	other threads:[~2026-11-24  3:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  3:04 [PATCH v2 0/9] media: i2c: it6625: add HDMI audio capture over I2S Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 1/9] media: v4l2-ctrls: add DV RX audio sampling rate and present controls Hermes Wu via B4 Relay
2026-11-24  3:09   ` sashiko-bot
2026-11-24  3:04 ` [PATCH v2 2/9] media: v4l2-ctrls: add the DV RX audio type control Hermes Wu via B4 Relay
2026-11-24  3:09   ` sashiko-bot
2026-11-24  3:04 ` [PATCH v2 3/9] media: i2c: tc358743: also report the standard audio controls Hermes Wu via B4 Relay
2026-11-24  3:14   ` sashiko-bot
2026-11-24  3:04 ` [PATCH v2 4/9] dt-bindings: media: ite,it6625: add audio DAI properties Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 5/9] media: i2c: it6625: decode audio status fields with FIELD_GET() Hermes Wu via B4 Relay
2026-11-24  3:04 ` [PATCH v2 6/9] media: i2c: it6625: add I2S audio capture DAI Hermes Wu via B4 Relay
2026-11-24  3:18   ` sashiko-bot [this message]
2026-11-24  3:04 ` [PATCH v2 7/9] media: i2c: it6625: capture compressed and HBR audio, not just LPCM Hermes Wu via B4 Relay
2026-11-24  3:11   ` sashiko-bot
2026-11-24  3:04 ` [PATCH v2 8/9] media: i2c: it6625: use the standard audio rate and present controls Hermes Wu via B4 Relay
2026-11-24  3:15   ` sashiko-bot
2026-11-24  3:04 ` [PATCH v2 9/9] media: uapi: it6625: remove the driver-specific audio controls Hermes Wu via B4 Relay
2026-11-24  3:11   ` sashiko-bot

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=sashiko-outbox-230449@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Hermes.wu@ite.com.tw \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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