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:   Sat,  9 Apr 2022 11:48:48 +0800
From:   Zheyu Ma <zheyuma97@...il.com>
To:     jic23@...nel.org, lars@...afoo.de
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Zheyu Ma <zheyuma97@...il.com>
Subject: [PATCH] iio: magnetometer: ak8974: Fix the error handling of ak8974_probe()

When the driver fail at devm_regmap_init_i2c(), we will get the
following splat:

[  106.797388] WARNING: CPU: 4 PID: 413 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0
[  106.802183] RIP: 0010:_regulator_put+0x3ec/0x4e0
[  106.811237] Call Trace:
[  106.811515]  <TASK>
[  106.811695]  regulator_bulk_free+0x82/0xe0
[  106.812032]  devres_release_group+0x319/0x3d0
[  106.812425]  i2c_device_probe+0x766/0x940

Fix this by disabling the regulators at the error path.

Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
---
 drivers/iio/magnetometer/ak8974.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index e54feacfb980..84bbf7ccc887 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -862,6 +862,7 @@ static int ak8974_probe(struct i2c_client *i2c,
 		dev_err(&i2c->dev, "failed to allocate register map\n");
 		pm_runtime_put_noidle(&i2c->dev);
 		pm_runtime_disable(&i2c->dev);
+		regulator_bulk_disable(ARRAY_SIZE(ak8974->regs), ak8974->regs);
 		return PTR_ERR(ak8974->map);
 	}
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ