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: <11862743.O9o76ZdvQC@kreacher>
Date:   Thu, 04 Nov 2021 22:54:17 +0100
From:   "Rafael J. Wysocki" <rjw@...ysocki.net>
To:     Linux ACPI <linux-acpi@...r.kernel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] ACPI: PM: Fix device wakeup power reference counting error

On Thursday, November 4, 2021 6:21:51 PM CET Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> Fix a device wakeup power reference counting error introduced by
> commit a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power
> resources").
> 
> Fixes: a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>  drivers/acpi/power.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> Index: linux-pm/drivers/acpi/power.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/power.c
> +++ linux-pm/drivers/acpi/power.c
> @@ -757,10 +757,8 @@ int acpi_disable_wakeup_device_power(str
>  
>  	mutex_lock(&acpi_device_lock);
>  
> -	if (dev->wakeup.prepare_count > 1) {
> +	if (dev->wakeup.prepare_count >= 1)
>  		dev->wakeup.prepare_count--;
> -		goto out;
> -	}
>  
>  	/* Do nothing if wakeup power has not been enabled for this device. */
>  	if (!dev->wakeup.prepare_count)

This is still not good.  It should be something like the patch below, but I
need to test that one.

---
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Subject: [PATCH v2] ACPI: PM: Fix device wakeup power reference counting error

Fix a device wakeup power reference counting error introduced by
commit a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power
resources").

Fixes: a2d7b2e004af ("ACPI: PM: Fix sharing of wakeup power resources")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---

-> v2: Actually disable wakeup power when the reference count becomes zero.

---
 drivers/acpi/power.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Index: linux-pm/drivers/acpi/power.c
===================================================================
--- linux-pm.orig/drivers/acpi/power.c
+++ linux-pm/drivers/acpi/power.c
@@ -757,13 +757,11 @@ int acpi_disable_wakeup_device_power(str
 
 	mutex_lock(&acpi_device_lock);
 
-	if (dev->wakeup.prepare_count > 1) {
-		dev->wakeup.prepare_count--;
+	/* Do nothing if wakeup power has not been enabled for this device. */
+	if (dev->wakeup.prepare_count <= 0)
 		goto out;
-	}
 
-	/* Do nothing if wakeup power has not been enabled for this device. */
-	if (!dev->wakeup.prepare_count)
+	if (--dev->wakeup.prepare_count > 0)
 		goto out;
 
 	err = acpi_device_sleep_wake(dev, 0, 0, 0);




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ