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: <201011302323.50475.rjw@sisk.pl>
Date:	Tue, 30 Nov 2010 23:23:50 +0100
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Ming Lei <tom.leiming@...il.com>
Cc:	"Linux-pm mailing list" <linux-pm@...ts.linux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Alan Stern <stern@...land.harvard.edu>
Subject: Re: [PATCH] PM: Prevent dpm_prepare() from returning errors unnecessarily

On Tuesday, November 30, 2010, Ming Lei wrote:
> 2010/11/28 Rafael J. Wysocki <rjw@...k.pl>:
> > From: Rafael J. Wysocki <rjw@...k.pl>
> >
> > Currently dpm_prepare() returns error code if it finds that a device
> > being suspended has a pending runtime resume request.  However, it
> > should not do that if the checking for wakeup events is not enabled.
> > On the other hand, if the checking for wakeup events is enabled, it
> > can return error when a wakeup event is detected, regardless of its
> > source.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
> > ---
> >  drivers/base/power/main.c |   11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > Index: linux-2.6/drivers/base/power/main.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/base/power/main.c
> > +++ linux-2.6/drivers/base/power/main.c
> > @@ -26,6 +26,7 @@
> >  #include <linux/interrupt.h>
> >  #include <linux/sched.h>
> >  #include <linux/async.h>
> > +#include <linux/suspend.h>
> >
> >  #include "../base.h"
> >  #include "power.h"
> > @@ -1052,8 +1053,10 @@ static int dpm_prepare(pm_message_t stat
> >                mutex_unlock(&dpm_list_mtx);
> >
> >                pm_runtime_get_noresume(dev);
> > -               if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) {
> > -                       /* Wake-up requested during system sleep transition. */
> > +               if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
> > +                       pm_wakeup_event(dev, 0);
> > +
> > +               if (pm_check_wakeup_events()) {
> 
> If pm_check_wakeup_events returns true, it means there is no wakeup event
> coming, so seems should handle normal suspend prepare, but why
> abort the suspend here?

That's a bug, it should be !pm_check_wakeup_events() instead.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ