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: <201010100043.47397.rjw@sisk.pl>
Date:	Sun, 10 Oct 2010 00:43:47 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	James Hogan <james@...anarts.com>
Cc:	linux-pm@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org, Len Brown <len.brown@...el.com>,
	Pavel Machek <pavel@....cz>,
	Randy Dunlap <rdunlap@...otime.net>,
	"Greg Kroah-Hartman" <gregkh@...e.de>,
	Alan Stern <stern@...land.harvard.edu>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	markgross <markgross@...gnar.org>
Subject: Re: [PATCH 1/2] pm_trace: Lock pm device list mutex.

On Sunday, October 10, 2010, James Hogan wrote:
> Lock the pm device list mutex using device_pm_lock() and
> device_pm_unlock() around the list iteration in show_dev_hash().
> 
> show_dev_hash() was reverse iterating dpm_list without first locking the
> mutex that the functions in drivers/base/power/main.c lock. I assume
> this was unintentional since there is no comment suggesting why the lock
> might not be necessary.
> 
> Signed-off-by: James Hogan <james@...anarts.com>

Looks good.

> ---
>  drivers/base/power/trace.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> index 0a1a2c4..17e24e3 100644
> --- a/drivers/base/power/trace.c
> +++ b/drivers/base/power/trace.c
> @@ -188,8 +188,10 @@ static int show_file_hash(unsigned int value)
>  static int show_dev_hash(unsigned int value)
>  {
>  	int match = 0;
> -	struct list_head *entry = dpm_list.prev;
> +	struct list_head *entry;
>  
> +	device_pm_lock();
> +	entry = dpm_list.prev;
>  	while (entry != &dpm_list) {
>  		struct device * dev = to_device(entry);
>  		unsigned int hash = hash_string(DEVSEED, dev_name(dev), DEVHASH);
> @@ -199,6 +201,7 @@ static int show_dev_hash(unsigned int value)
>  		}
>  		entry = entry->prev;
>  	}
> +	device_pm_unlock();
>  	return match;
>  }
>  
> 

--
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