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:   Mon, 26 Sep 2016 17:26:50 -0700
From:   Stefan Agner <stefan@...er.ch>
To:     linus.walleij@...aro.org
Cc:     shawnguo@...nel.org, vladimir_zapolskiy@...tor.com,
        aalonso@...escale.com, b38343@...escale.com, ldewangan@...dia.com,
        van.freenix@...il.com, p.zabel@...gutronix.de,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Stefan Agner <stefan@...er.ch>
Subject: [PATCH] pinctrl: freescale: avoid overwriting pin config when freeing GPIO

If a GPIO gets freed after selecting a new pinctrl configuration
the driver should not change pinctrl anymore. Otherwise this will
likely lead to a unusable pin configuration for the newly selected
pinctrl.

Signed-off-by: Stefan Agner <stefan@...er.ch>
---
This turned out to be problematic when using the I2C GPIO bus recovery
functionality. After muxing back to I2C, the GPIO is being freed, which
cased I2C to stop working completely.

--
Stefan

 drivers/pinctrl/freescale/pinctrl-imx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 4761320..61cfa95 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -361,8 +361,13 @@ static void imx_pmx_gpio_disable_free(struct pinctrl_dev *pctldev,
 	if (pin_reg->mux_reg == -1)
 		return;
 
-	/* Clear IBE/OBE/PUE to disable the pin (Hi-Z) */
 	reg = readl(ipctl->base + pin_reg->mux_reg);
+
+	/* Only change pad configuration if pad is still a GPIO */
+	if (reg & (0x7 << 20))
+		return;
+
+	/* Clear IBE/OBE/PUE to disable the pin (Hi-Z) */
 	reg &= ~0x7;
 	writel(reg, ipctl->base + pin_reg->mux_reg);
 }
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ