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: <57165857.5050809@nvidia.com>
Date:	Tue, 19 Apr 2016 17:09:59 +0100
From:	Jon Hunter <jonathanh@...dia.com>
To:	Mark Brown <broonie@...nel.org>
CC:	Thierry Reding <thierry.reding@...il.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/5] regulator: core: Resolve supply earlier


On 19/04/16 16:40, Mark Brown wrote:
> * PGP Signed by an unknown key
> 
> On Tue, Apr 19, 2016 at 11:16:59AM +0100, Jon Hunter wrote:
> 
>> So the following seems to work, but only item I am uncertain about
>> is if it is ok to move the mutex_lock to after the
>> machine_set_constraints()?
> 
> We definitely don't need the list to apply constraints to a single
> regulator.
> 
>> +	mutex_lock(&regulator_list_mutex);
>> +
>>  	ret = device_register(&rdev->dev);
>>  	if (ret != 0) {
>>  		put_device(&rdev->dev);
>> +		mutex_unlock(&regulator_list_mutex);
>>  		goto wash;
>>  	}
> 
> This is *really* weird.  Why would we need the list lock to do a
> device_register()?  

The device_register() is going to add the regulator to the 
regulator class list and this means that after this, someone
could look up that regulator via ...

 static struct regulator_dev *of_find_regulator_by_node(struct device_node *np)
 {
         struct device *dev;
 
         dev = class_find_device(&regulator_class, NULL, np, of_node_match);
 
        return dev ? dev_to_rdev(dev) : NULL;
 }

So I did not think that we would want someone to be able to 
look-up the regulator via of_find_regulator_by_node() until
it had been registered successfully. In fact I believe that
not locking around device_register() was causing some crashes
when I was testing.

Cheers
Jon

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ