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: <a57a8a4b-3715-8748-a638-f1550ab587fc@mleia.com>
Date:   Thu, 13 Aug 2020 11:29:40 +0300
From:   Vladimir Zapolskiy <vz@...ia.com>
To:     Michał Mirosław <mirq-linux@...e.qmqm.pl>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
Cc:     Dmitry Osipenko <digetx@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/7] regulator: plug of_node leak in
 regulator_register()'s error path

On 8/12/20 5:09 PM, Michał Mirosław wrote:
> On Wed, Aug 12, 2020 at 09:29:12AM +0300, Vladimir Zapolskiy wrote:
>> On 8/12/20 4:31 AM, Michał Mirosław wrote:
> [...]
>>>  	config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL);
>>>  	if (config == NULL) {
>>> -		kfree(rdev);
>>>  		ret = -ENOMEM;
>>> -		goto rinse;
>>> +		goto clean;
> [...]
>>>  clean:
>>>  	if (dangling_of_gpiod)
>>>  		gpiod_put(config->ena_gpiod);
>>
>> And above 'config' NULL pointer could be dereferenced now, right?
> 
> If config is NULL, dangling_of_gpiod cannot be true.
> 

It's true, thanks. Probably to avoid the known if(false) it might be better
to add a new goto label.

Also it seems to me that it's safe to enter regulator_dev_release() before
doing an assignment to rdev->dev.of_node and incrementing an of_node counter.

Reviewed-by: Vladimir Zapolskiy <vz@...ia.com>

--
Best wishes,
Vladimir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ