All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH 2/5] media: verisilicon: Don't hold a VPU behind an IOMMU in reset after remove
Date: Tue, 10 Nov 2026 07:50:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-206534@kernel.org> (raw)
In-Reply-To: <20261110-hantro-robust-v1-2-6b6269c05bfa@gmail.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] media: verisilicon: null pointer dereference in hantro_probe()
  [1]
--

commit 4e4d9ad2d3b9dfeb29c03b860ceeca44937863cf
Author: Arun Iyengar <aiyengar1990@gmail.com>

media: verisilicon: Don't hold a VPU behind an IOMMU in reset after remove

This commit leaves the resets of a VPU behind an IOMMU deasserted during
probe error cleanup and driver removal so the IOMMU can access its
registers when it subsequently runtime suspends.

> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 26e5d5547466e..702d878c7b509 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -1069,6 +1069,22 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
>  	return v4l2_m2m_init(&vpu_m2m_ops);
>  }
>  
> +/*
> + * The resets may also cover the bus interface that the IOMMU of the VPU is
> + * accessed through, e.g. on the RK3588 AV1 decoder. The IOMMU is a separate
> + * device which is runtime resumed with the VPU while it is unbound, and
> + * accesses its registers again when it runtime suspends afterwards. Holding
> + * the VPU in reset at that point causes an asynchronous external abort, so
> + * leave the resets deasserted for a VPU behind an IOMMU.
> + */
> +static void hantro_reset_assert(struct hantro_dev *vpu)
> +{
> +	if (device_iommu_mapped(vpu->dev))
> +		return;
> +
> +	reset_control_assert(vpu->resets);
> +}
> +
>  static int hantro_probe(struct platform_device *pdev)
>  {
>  	const struct of_device_id *match;

[Severity: High]
This problem wasn't introduced by this patch, but can hantro_probe() hit a
NULL pointer dereference [1] when dereferencing match->data?

drivers/media/platform/verisilicon/hantro_drv.c:hantro_probe() {
	...
	match = of_match_node(of_hantro_match, pdev->dev.of_node);
	vpu->variant = match->data;
	...
}

If a probe is forced via sysfs bind on a device without a matching OF node,
of_match_node() returns NULL and match->data is dereferenced
unconditionally.

[1] https://sashiko.dev/#/bug/linux-4e7cd977-2daf-4048-ad53-7801b4bba80e

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-hantro-robust-v1-0-6b6269c05bfa@gmail.com?part=2

  reply	other threads:[~2026-11-10  7:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  7:17 [PATCH 0/5] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts Arun Iyengar via B4 Relay
2026-11-10  7:17 ` Arun Iyengar
2026-11-10  7:17 ` Arun Iyengar via B4 Relay
2026-11-10  7:17 ` [PATCH 1/5] dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines Arun Iyengar via B4 Relay
2026-11-10  7:17   ` Arun Iyengar
2026-11-10  7:17   ` Arun Iyengar via B4 Relay
2026-11-10  7:17 ` [PATCH 2/5] media: verisilicon: Don't hold a VPU behind an IOMMU in reset after remove Arun Iyengar via B4 Relay
2026-11-10  7:17   ` Arun Iyengar
2026-11-10  7:17   ` Arun Iyengar via B4 Relay
2026-11-10  7:50   ` sashiko-bot [this message]
2026-11-10  7:17 ` [PATCH 3/5] media: verisilicon: Reset the Rockchip encoder cores on timeout Arun Iyengar via B4 Relay
2026-11-10  7:17   ` Arun Iyengar
2026-11-10  7:17   ` Arun Iyengar via B4 Relay
2026-11-10  8:11   ` sashiko-bot
2026-11-10  7:17 ` [PATCH 4/5] media: verisilicon: Reinitialize the IOMMU after a timeout Arun Iyengar via B4 Relay
2026-11-10  7:17   ` Arun Iyengar
2026-11-10  7:17   ` Arun Iyengar via B4 Relay
2026-11-10  8:37   ` sashiko-bot
2026-11-10  7:17 ` [PATCH 5/5] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores Arun Iyengar via B4 Relay
2026-11-10  7:17   ` Arun Iyengar
2026-11-10  7:17   ` Arun Iyengar 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-206534@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@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.