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] [day] [month] [year] [list]
Message-ID: <0c9a06af-78e2-477d-99a4-b5626a1f791b@icloud.com>
Date: Wed, 13 Nov 2024 20:59:08 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@....cz>,
 Len Brown <len.brown@...el.com>, linux-pm@...r.kernel.org,
 linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>,
 stable@...r.kernel.org
Subject: Re: [PATCH RESEND] PM: domains: Fix return value of API
 dev_pm_get_subsys_data()

On 2024/11/12 19:46, Greg Kroah-Hartman wrote:
> On Mon, Oct 28, 2024 at 08:31:11PM +0800, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@...cinc.com>
>>
>> dev_pm_get_subsys_data() has below 2 issues under condition
>> (@dev->power.subsys_data != NULL):
>>
>> - it will do unnecessary kzalloc() and kfree().
> 
> But that's ok, everything still works, right?
> 

i don't think so, as explained below:

under condition (@dev->power.subsys_data != NULL), the API does
not need to do kzalloc() and should always return 0 (success).

but it actually does *unnecessary* kzalloc() and have below impact
shown:

if (kzalloc() is successfully)
	it will degrade the API's performance
else
        it changed the API's return value to -ENOMEM from 0, that
        will impact caller's logic.

>> - it will return -ENOMEM if the kzalloc() fails, that is wrong
>>   since the kzalloc() is not needed.
> 
> But it's ok to return the proper error if the system is that broken.
> >>
>> Fixed by not doing kzalloc() and returning 0 for the condition.
>>
>> Fixes: ef27bed1870d ("PM: Reference counting of power.subsys_data")
>> Cc: stable@...r.kernel.org
> 
> Why is this relevant for stable kernels?
> 

it has impact related to performance and logic as explained above.

> thanks,
> 
> greg k-h


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ