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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230816200410.62131-4-yann@sionneau.net>
Date:   Wed, 16 Aug 2023 22:04:09 +0200
From:   Yann Sionneau <yann@...nneau.net>
To:     Andi Shyti <andi.shyti@...nel.org>,
        Codrin Ciubotariu <codrin.ciubotariu@...rochip.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Claudiu Beznea <claudiu.beznea@...on.dev>,
        Michal Simek <michal.simek@....com>,
        Oleksij Rempel <linux@...pel-privat.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>
Cc:     linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        Yann Sionneau <yann@...nneau.net>
Subject: [PATCH 3/4] i2c: i2c-cadence: Reset pinctrl to NULL in case devm_pinctrl_get() fails

The core i2c code generally checks if pinctrl has been properly initialized
by just doing 'if (p) some_pinctrl_function(p)'.
In case devm_pinctrl_get() fails, pinctrl variable contains an error
instead of a valid pointer.
To prevent core i2c code to crash, reset back pinctrl pointer to NULL when
this happens.

Signed-off-by: Yann Sionneau <yann@...nneau.net>
---
 drivers/i2c/busses/i2c-cadence.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 9849f4502570..aa9ae0755674 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -1299,6 +1299,7 @@ static int cdns_i2c_probe(struct platform_device *pdev)
 	if (IS_ERR(id->rinfo.pinctrl)) {
 		int err = PTR_ERR(id->rinfo.pinctrl);
 
+		id->rinfo.pinctrl = NULL;
 		dev_info(&pdev->dev, "can't get pinctrl, bus recovery not supported\n");
 		if (err != -ENODEV)
 			return err;
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ