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]
Date:   Wed, 24 Mar 2021 14:55:40 +0200
From:   Alexandru Ardelean <aardelean@...iqon.com>
To:     platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-iio@...r.kernel.org
Cc:     coproscefalo@...il.com, hdegoede@...hat.com,
        mgross@...ux.intel.com, jic23@...nel.org, linux@...iqon.com,
        Alexandru Ardelean <aardelean@...iqon.com>
Subject: [PATCH 02/10] platform/x86: toshiba_acpi: use devm_add_action_or_reset() for singleton clear

The only reason to do this is to enforce the ordering of deinitialization,
when the conversion of the device-managed functions is done.

The singleton object should be cleared right before it is free'd.

Signed-off-by: Alexandru Ardelean <aardelean@...iqon.com>
---
 drivers/platform/x86/toshiba_acpi.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 6d298810b7bf..c5284601bc2a 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -2995,9 +2995,6 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev)
 		rfkill_destroy(dev->wwan_rfk);
 	}
 
-	if (toshiba_acpi)
-		toshiba_acpi = NULL;
-
 	return 0;
 }
 
@@ -3012,6 +3009,11 @@ static const char *find_hci_method(acpi_handle handle)
 	return NULL;
 }
 
+static void toshiba_acpi_singleton_clear(void *data)
+{
+	toshiba_acpi = NULL;
+}
+
 static int toshiba_acpi_add(struct acpi_device *acpi_dev)
 {
 	struct device *parent = &acpi_dev->dev;
@@ -3035,6 +3037,13 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
 	dev = devm_kzalloc(parent, sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 		return -ENOMEM;
+
+	ret = devm_add_action_or_reset(parent,
+				       toshiba_acpi_singleton_clear,
+				       NULL);
+	if (ret)
+		return ret;
+
 	dev->acpi_dev = acpi_dev;
 	dev->method_hci = hci_method;
 	dev->miscdev.minor = MISC_DYNAMIC_MINOR;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ