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]
Message-Id: <20230111141346.1516-1-musashino.open@gmail.com>
Date:   Wed, 11 Jan 2023 23:13:46 +0900
From:   INAGAKI Hiroshi <musashino.open@...il.com>
To:     rogerq@...nel.org, tony@...mide.com, krzysztof.kozlowski@...aro.org
Cc:     linux-omap@...r.kernel.org, linux-kernel@...r.kernel.org,
        INAGAKI Hiroshi <musashino.open@...il.com>
Subject: [PATCH] memory: omap-gpmc: fix multi-device handling on the same CS

This patch fixes the handling of multiple devices on the same CS by
replacing CS name to "name" of node instead of "full_name".

In c2ade654dbf7d02f09ad491f5621fc321d4af96b
("memory: omap-gpmc: Use of_node_name_eq for node name comparisons"),
the name for setting to CS was replaced but it doesn't fit for the
comparison by of_node_name_eq.
In of_node_name_eq, the length for strncmp will be obtained from the
node that trying to register and it doesn't contain the length of
"@<cs>,<offset>". But the base name for comparison passed from
registered CS name contains the prefix, then, that two lengths won't
match and false will be returned, and registration on the same CS
will be failed.

example (Century Systems MA-E350/N, AM3352):

- Device Tree

  /* memory mapped gpio controllers on GPMC */
  gpio@2,2 {
      reg = <2 0x2 0x1>; /* CS2, offset 0x2, IO size 0x1 */
      ...
  };

  gpio@2,10 {
      reg = <2 0x10 0x1>; /* CS2, offset 0x10, IO size 0x1 */
      ...
  };

  gpio@2,12 {
      reg = <2 0x12 0x1>; /* CS2, offset 0x12, IO size 0x1 */
      ...
  };

  gpio@2,14 {
      reg = <2 0x14 0x1>; /* CS2, offset 0x14, IO size 0x1 */
      ...
  };

- dmesg

  [    1.596402] omap-gpmc 50000000.gpmc: cannot request GPMC CS 2
  [    1.596434] omap-gpmc 50000000.gpmc: failed to probe DT child 'gpio': -16
  [    1.596489] omap-gpmc 50000000.gpmc: cannot request GPMC CS 2
  [    1.596511] omap-gpmc 50000000.gpmc: failed to probe DT child 'gpio': -16
  [    1.596564] omap-gpmc 50000000.gpmc: cannot request GPMC CS 2
  [    1.596586] omap-gpmc 50000000.gpmc: failed to probe DT child 'gpio': -16

  ("gpio@2,2" is ok, "gpio@2,10", "gpio@2,12", "gpio@...4" are fail)

Fixes: c2ade654dbf7d02f09ad491f5621fc321d4af96b
("memory: omap-gpmc: Use of_node_name_eq for node name comparisons")

Signed-off-by: INAGAKI Hiroshi <musashino.open@...il.com>
---
 drivers/memory/omap-gpmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index d78f73db37c8..3e3e84e34795 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2202,7 +2202,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
 		dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs);
 		return ret;
 	}
-	gpmc_cs_set_name(cs, child->full_name);
+	gpmc_cs_set_name(cs, child->name);
 
 	gpmc_read_settings_dt(child, &gpmc_s);
 	gpmc_read_timings_dt(child, &gpmc_t);

base-commit: 13f35b3c72f4075e13a974f439b20b9e26f8f243
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ