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: <20220724164316.68393-2-matti.lehtimaki@gmail.com>
Date:   Sun, 24 Jul 2022 19:43:16 +0300
From:   Matti Lehtimäki <matti.lehtimaki@...il.com>
To:     linux-iio@...r.kernel.org
Cc:     ~postmarketos/upstreaming@...ts.sr.ht,
        Matti Lehtimäki <matti.lehtimaki@...il.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Cai Huoqing <cai.huoqing@...ux.dev>,
        Alexandru Ardelean <aardelean@...iqon.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] iio: st_sensors: Fix null pointer on defer_probe error

dev_err_probe() calls __device_set_deferred_probe_reason()
on -EPROBE_DEFER error. The device pointer to driver core private
structure is not yet initialized at this stage for the iio device causing
a null pointer error. Use parent device instead.

Fixes: 4dff75487695 ("iio: st_sensors: Make use of the helper function dev_err_probe()")
Signed-off-by: Matti Lehtimäki <matti.lehtimaki@...il.com>
---
 drivers/iio/common/st_sensors/st_sensors_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 106f7953683e..575607058291 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -235,7 +235,7 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)
 	/* Regulators not mandatory, but if requested we should enable them. */
 	pdata->vdd = devm_regulator_get(parent, "vdd");
 	if (IS_ERR(pdata->vdd))
-		return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd),
+		return dev_err_probe(indio_dev->dev.parent, PTR_ERR(pdata->vdd),
 				     "unable to get Vdd supply\n");
 
 	err = regulator_enable(pdata->vdd);
@@ -251,7 +251,7 @@ int st_sensors_power_enable(struct iio_dev *indio_dev)
 
 	pdata->vdd_io = devm_regulator_get(parent, "vddio");
 	if (IS_ERR(pdata->vdd_io))
-		return dev_err_probe(&indio_dev->dev, PTR_ERR(pdata->vdd_io),
+		return dev_err_probe(indio_dev->dev.parent, PTR_ERR(pdata->vdd_io),
 				     "unable to get Vdd_IO supply\n");
 
 	err = regulator_enable(pdata->vdd_io);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ