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: <24b2d8b0c3536408369add034221b1141e58bbfc.1606908582.git.Adam.Ward.opensource@diasemi.com>
Date:   Wed, 2 Dec 2020 11:32:47 +0000
From:   Adam Ward <Adam.Ward.opensource@...semi.com>
To:     Mark Brown <broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>
CC:     Liam Girdwood <lgirdwood@...il.com>,
        Vincent Whitchurch <vincent.whitchurch@...s.com>,
        <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
        Support Opensource <support.opensource@...semi.com>
Subject: [PATCH V2 1/1] regulator: da9121: Request IRQ directly and free in
 release function to avoid masking race

Signed-off-by: Adam Ward <Adam.Ward.opensource@...semi.com>
---
 drivers/regulator/da9121-regulator.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c
index d9a8a4b..3ead6a1 100644
--- a/drivers/regulator/da9121-regulator.c
+++ b/drivers/regulator/da9121-regulator.c
@@ -945,8 +945,7 @@ static int da9121_config_irq(struct i2c_client *i2c,
 
 		chip->passive_delay = p_delay;
 
-		ret = devm_request_threaded_irq(chip->dev,
-					chip->chip_irq, NULL,
+		ret = request_threaded_irq(chip->chip_irq, NULL,
 					da9121_irq_handler,
 					IRQF_TRIGGER_LOW|IRQF_ONESHOT,
 					"da9121", chip);
@@ -960,7 +959,7 @@ static int da9121_config_irq(struct i2c_client *i2c,
 		if (ret != 0) {
 			dev_err(chip->dev, "Failed to set IRQ masks: %d\n",
 				ret);
-			goto error;
+			goto regmap_error;
 		}
 
 		INIT_DELAYED_WORK(&chip->work, da9121_status_poll_on);
@@ -969,6 +968,9 @@ static int da9121_config_irq(struct i2c_client *i2c,
 	}
 error:
 	return ret;
+regmap_error:
+	free_irq(chip->chip_irq, chip);
+	return ret;
 }
 
 static const struct of_device_id da9121_dt_ids[] = {
@@ -1036,6 +1038,7 @@ static int da9121_i2c_remove(struct i2c_client *i2c)
 	const int mask_all[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
 	int ret = 0;
 
+	free_irq(chip->chip_irq, chip);
 	cancel_delayed_work_sync(&chip->work);
 
 	ret = regmap_bulk_write(chip->regmap, DA9121_REG_SYS_MASK_0, mask_all, 4);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ