All of lore.kernel.org
 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 v3 6/9] media: i2c: it6625: add I2S audio capture DAI
Date: Wed, 02 Dec 2026 03:41:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-244793@kernel.org> (raw)
In-Reply-To: <20261202-upstream-it6625-alsa-i2s-v3-6-4747dd34b30c@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 a36675d9bf48d6df984c2c02be37d3a54770
Author: Hermes Wu <Hermes.wu@ite.com.tw>

media: i2c: it6625: add I2S audio capture DAI

This commit registers an ASoC capture DAI for the IT6625/IT6626 I2S audio
output and keeps the V4L2 audio controls updated from the sampled audio
status.

> diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
> index 6ff5a5574b379..5cb8b15ea8f70 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 cec_adap and it6625->hdl
are torn down if it6625_audio_register() fails?

Once v4l2_async_register_subdev() exposes the subdev, a bound bridge can
invoke subdev ops such as it6625_isr() (queuing polling_work) or
it6625_s_edid() (queuing hpd_delayed_work) before it6625_audio_register()
fails and calls v4l2_async_unregister_subdev().  On the err_clean_debugfs
path, cec_adap and the V4L2 controls are destroyed before
err_clean_work_queues cancels those work items:

CPU0                                  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
  ...
  v4l2_ctrl_handler_free(&it6625->hdl)
                                      it6625_polling_work()
                                        ...
                                          it6625_s_ctrl_detect_hdmi_5v()
                                            <-- use-after-free on ctrl
  err_clean_work_queues:
  cancel_work_sync(&it6625->polling_work)

Canceling polling_work and hpd_delayed_work right after
v4l2_async_unregister_subdev() (or before tearing down cec_adap, sd and
hdl) would avoid this regression.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-upstream-it6625-alsa-i2s-v3-0-4747dd34b30c@ite.com.tw?part=6

  reply	other threads:[~2026-12-02  3:41 UTC|newest]

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

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-244793@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.