lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 13 Oct 2022 20:32:14 +0800
From:   "Peng Fan (OSS)" <peng.fan@....nxp.com>
To:     andersson@...nel.org, mathieu.poirier@...aro.org,
        arnaud.pouliquen@...s.st.com, linux-remoteproc@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Peng Fan <peng.fan@....com>
Subject: [PATCH] remoteproc: core: avoid duplicated rproc-virtio.[x] device

From: Peng Fan <peng.fan@....com>

When there are multiple remoteproc cores(i.MX8QM has dual CM4), there
will be duplicated platform device created. When 1st CM4 rproc got
probed, rproc-virtio.0 was registered. Then 2nd CM4 rproc continue
register rproc-virtio.o will report failure.

So use PLATFORM_DEVID_AUTO here. Then the kernel log will has such:
rproc-virtio rproc-virtio.1.auto: registered virtio0 (type 7)

Fixes: 1d7b61c06dc3 ("remoteproc: virtio: Create platform device for the remoteproc_virtio")
Signed-off-by: Peng Fan <peng.fan@....com>
---

V1:
  I think this issue will happen when more than one rproc, saying CM4 + DSP,
or CM4 + CM4.
  I thought to add a index to rproc, then use
  'rproc->index * rvdev_data.index' as the id, but seems a bit complicated
  compared with use PLATFORM_DEVID_AUTO.


 drivers/remoteproc/remoteproc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 8768cb64f560..03a26498e879 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -509,7 +509,7 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr,
 	rvdev_data.rsc_offset = offset;
 	rvdev_data.rsc = rsc;
 
-	pdev = platform_device_register_data(dev, "rproc-virtio", rvdev_data.index, &rvdev_data,
+	pdev = platform_device_register_data(dev, "rproc-virtio", PLATFORM_DEVID_AUTO, &rvdev_data,
 					     sizeof(rvdev_data));
 	if (IS_ERR(pdev)) {
 		dev_err(dev, "failed to create rproc-virtio device\n");
-- 
2.37.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ