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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220929050426.955139-1-dmitry.torokhov@gmail.com>
Date:   Wed, 28 Sep 2022 22:04:25 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        Krzysztof Opasiak <k.opasiak@...sung.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH net-next 1/2] nfc: s3fwrn5: fix order of freeing resources

Caution needs to be exercised when mixing together regular and managed
resources. In case of this driver devm_request_threaded_irq() should
not be used, because it will result in the interrupt being freed too
late, and there being a chance that it fires up at an inopportune
moment and reference already freed data structures.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
---
 drivers/nfc/s3fwrn5/i2c.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
index f824dc7099ce..fb36860df81c 100644
--- a/drivers/nfc/s3fwrn5/i2c.c
+++ b/drivers/nfc/s3fwrn5/i2c.c
@@ -231,9 +231,9 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client,
 	if (ret < 0)
 		goto disable_clk;
 
-	ret = devm_request_threaded_irq(&client->dev, phy->i2c_dev->irq, NULL,
-		s3fwrn5_i2c_irq_thread_fn, IRQF_ONESHOT,
-		S3FWRN5_I2C_DRIVER_NAME, phy);
+	ret = request_threaded_irq(phy->i2c_dev->irq,
+				   NULL, s3fwrn5_i2c_irq_thread_fn,
+				   IRQF_ONESHOT, S3FWRN5_I2C_DRIVER_NAME, phy);
 	if (ret)
 		goto s3fwrn5_remove;
 
@@ -250,6 +250,7 @@ static void s3fwrn5_i2c_remove(struct i2c_client *client)
 {
 	struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client);
 
+	free_irq(phy->i2c_dev->irq, phy);
 	s3fwrn5_remove(phy->common.ndev);
 	clk_disable_unprepare(phy->clk);
 }
-- 
2.38.0.rc1.362.ged0d419d3c-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ