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]
Message-Id: <20180508030811.12256-1-baijiaju1990@gmail.com>
Date:   Tue,  8 May 2018 11:08:11 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     rjw@...ysocki.net, lenb@...nel.org
Cc:     linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] acpi: scan: Fix a possible data race in acpi_scan_hotplug_enabled

The write operation to "hotplug->enabled" is protected by
the lock on line 1760, but the read operation to
this data on line 1755 is not protected by the lock.
Thus, there may exist a data race for "hotplug->enabled".

To fix this data race, the read operation to "hotplug->enabled" is 
also protected by the lock.

Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
 drivers/acpi/scan.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 970dd87d347c..e21d7b0f7179 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1752,11 +1752,13 @@ static struct acpi_scan_handler *acpi_scan_match_handler(const char *idstr,
 
 void acpi_scan_hotplug_enabled(struct acpi_hotplug_profile *hotplug, bool val)
 {
-	if (!!hotplug->enabled == !!val)
-		return;
-
 	mutex_lock(&acpi_scan_lock);
 
+	if (!!hotplug->enabled == !!val) {
+		mutex_unlock(&acpi_scan_lock);
+		return;
+	}
+
 	hotplug->enabled = val;
 
 	mutex_unlock(&acpi_scan_lock);
-- 
2.17.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ