All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Iyengar <aiyengar1990@gmail.com>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	 Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	 Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
	 Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	 Hans Verkuil <hverkuil@kernel.org>,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	 "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	 Robin Murphy <robin.murphy@arm.com>,
	Ulf Hansson <ulfh@kernel.org>
Cc: linux-media@vger.kernel.org, iommu@lists.linux.dev,
	 linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Sergei Khomenkov <shomenkow@gmail.com>,
	 Tharit Tangkijwanichakul <tharitt97@gmail.com>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe()
Date: Sun, 06 Dec 2026 05:57:37 +0000	[thread overview]
Message-ID: <20261206-hantro-robust-v4-2-b99d33a5ec6d@gmail.com> (raw)
In-Reply-To: <20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com>

A device bound through driver_override may have no OF match, and
hantro_probe() then dereferences a NULL match. Use
device_get_match_data() and fail with -ENODEV without match data.

Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/media/platform/verisilicon/hantro_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 5c962847fdf5..da9813c60cf7 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/videodev2.h>
 #include <linux/workqueue.h>
@@ -1099,7 +1100,6 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
 
 static int hantro_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct hantro_dev *vpu;
 	int i, ret;
 
@@ -1112,8 +1112,9 @@ static int hantro_probe(struct platform_device *pdev)
 	mutex_init(&vpu->vpu_mutex);
 	spin_lock_init(&vpu->irqlock);
 
-	match = of_match_node(of_hantro_match, pdev->dev.of_node);
-	vpu->variant = match->data;
+	vpu->variant = device_get_match_data(&pdev->dev);
+	if (!vpu->variant)
+		return -ENODEV;
 
 	ret = hantro_disable_multicore(vpu);
 	if (ret)

-- 
2.55.0


WARNING: multiple messages have this Message-ID (diff)
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	 Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	 Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
	 Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	 Hans Verkuil <hverkuil@kernel.org>,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	 "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	 Robin Murphy <robin.murphy@arm.com>,
	Ulf Hansson <ulfh@kernel.org>
Cc: linux-media@vger.kernel.org, iommu@lists.linux.dev,
	 linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Sergei Khomenkov <shomenkow@gmail.com>,
	 Tharit Tangkijwanichakul <tharitt97@gmail.com>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe()
Date: Sun, 06 Dec 2026 05:57:37 +0000	[thread overview]
Message-ID: <20261206-hantro-robust-v4-2-b99d33a5ec6d@gmail.com> (raw)
In-Reply-To: <20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

A device bound through driver_override may have no OF match, and
hantro_probe() then dereferences a NULL match. Use
device_get_match_data() and fail with -ENODEV without match data.

Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/media/platform/verisilicon/hantro_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 5c962847fdf5..da9813c60cf7 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/videodev2.h>
 #include <linux/workqueue.h>
@@ -1099,7 +1100,6 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
 
 static int hantro_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct hantro_dev *vpu;
 	int i, ret;
 
@@ -1112,8 +1112,9 @@ static int hantro_probe(struct platform_device *pdev)
 	mutex_init(&vpu->vpu_mutex);
 	spin_lock_init(&vpu->irqlock);
 
-	match = of_match_node(of_hantro_match, pdev->dev.of_node);
-	vpu->variant = match->data;
+	vpu->variant = device_get_match_data(&pdev->dev);
+	if (!vpu->variant)
+		return -ENODEV;
 
 	ret = hantro_disable_multicore(vpu);
 	if (ret)

-- 
2.55.0



WARNING: multiple messages have this Message-ID (diff)
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	 Benjamin Gaignard <benjamin.gaignard@collabora.com>,
	 Philipp Zabel <p.zabel@pengutronix.de>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	 Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
	 Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	 Hans Verkuil <hverkuil@kernel.org>,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Jernej Skrabec <jernej.skrabec@gmail.com>,
	 "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	 Robin Murphy <robin.murphy@arm.com>,
	Ulf Hansson <ulfh@kernel.org>
Cc: linux-media@vger.kernel.org, iommu@lists.linux.dev,
	 linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Sergei Khomenkov <shomenkow@gmail.com>,
	 Tharit Tangkijwanichakul <tharitt97@gmail.com>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe()
Date: Sun, 06 Dec 2026 05:57:37 +0000	[thread overview]
Message-ID: <20261206-hantro-robust-v4-2-b99d33a5ec6d@gmail.com> (raw)
In-Reply-To: <20261206-hantro-robust-v4-0-b99d33a5ec6d@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

A device bound through driver_override may have no OF match, and
hantro_probe() then dereferences a NULL match. Use
device_get_match_data() and fail with -ENODEV without match data.

Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/media/platform/verisilicon/hantro_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 5c962847fdf5..da9813c60cf7 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/videodev2.h>
 #include <linux/workqueue.h>
@@ -1099,7 +1100,6 @@ static struct v4l2_m2m_dev *hantro_get_v4l2_m2m_dev(struct hantro_dev *vpu)
 
 static int hantro_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
 	struct hantro_dev *vpu;
 	int i, ret;
 
@@ -1112,8 +1112,9 @@ static int hantro_probe(struct platform_device *pdev)
 	mutex_init(&vpu->vpu_mutex);
 	spin_lock_init(&vpu->irqlock);
 
-	match = of_match_node(of_hantro_match, pdev->dev.of_node);
-	vpu->variant = match->data;
+	vpu->variant = device_get_match_data(&pdev->dev);
+	if (!vpu->variant)
+		return -ENODEV;
 
 	ret = hantro_disable_multicore(vpu);
 	if (ret)

-- 
2.55.0



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2026-12-06  5:57 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  5:57 [PATCH v4 00/18] media: verisilicon: Recover the Rockchip VPUs from faults and timeouts Arun Iyengar
2026-12-06  5:57 ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 01/18] dt-bindings: media: rockchip,rk3568-vepu: Add the reset lines Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` Arun Iyengar [this message]
2026-12-06  5:57   ` [PATCH v4 02/18] media: verisilicon: Check the match data in hantro_probe() Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 03/18] media: verisilicon: Complete the request when the VPU can't resume Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 04/18] media: verisilicon: Copy the buffer metadata before a job can fail Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 05/18] media: verisilicon: Don't hold the VPU in reset after remove Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 06/18] media: verisilicon: Disable runtime PM before unpreparing the clocks on probe failure Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  6:11   ` sashiko-bot
2026-12-06  5:57 ` [PATCH v4 07/18] media: verisilicon: Enable the Rockchip encoder interrupt again after a reset Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 08/18] media: verisilicon: Reset the Rockchip encoder cores on timeout Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  6:23   ` sashiko-bot
2026-12-06  5:57 ` [PATCH v4 09/18] media: verisilicon: Reinitialize the IOMMU after resetting an encoder core Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  6:21   ` sashiko-bot
2026-12-06  5:57 ` [PATCH v4 10/18] media: verisilicon: Acquire the reset lines only while using them Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 11/18] dt-bindings: iommu: verisilicon: Add the reset lines Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 12/18] iommu/vsi: Deassert the reset lines on probe Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 13/18] arm64: dts: rockchip: Add the reset lines of the RK3588 VEPU121 cores Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  6:26   ` sashiko-bot
2026-12-06  5:57 ` [PATCH v4 14/18] arm64: dts: rockchip: Add the reset lines of the RK3588 AV1 IOMMU Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  6:21   ` sashiko-bot
2026-12-06  5:57 ` [PATCH v4 15/18] pmdomain: rockchip: Add rockchip_pmu_idle_reset() Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 16/18] dt-bindings: media: rockchip-vpu: Add reset-names Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 17/18] media: verisilicon: Reset the RK3588 AV1 decoder after an error Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57 ` [PATCH v4 18/18] arm64: dts: rockchip: Name the RK3588 AV1 decoder resets Arun Iyengar
2026-12-06  5:57   ` Arun Iyengar via B4 Relay
2026-12-06  5:57   ` 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=20261206-hantro-robust-v4-2-b99d33a5ec6d@gmail.com \
    --to=aiyengar1990@gmail.com \
    --cc=andrzej.p@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=frattaroli.nicolas@gmail.com \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=joro@8bytes.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shomenkow@gmail.com \
    --cc=tharitt97@gmail.com \
    --cc=ulfh@kernel.org \
    --cc=will@kernel.org \
    /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.