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]
Date:   Wed, 27 Sep 2023 17:53:57 +0800
From:   Zhenhua Huang <quic_zhenhuah@...cinc.com>
To:     Greg KH <gregkh@...uxfoundation.org>
CC:     <rafael@...nel.org>, <linux-kernel@...r.kernel.org>,
        <quic_pkondeti@...cinc.com>, <quic_tingweiz@...cinc.com>,
        <saravanak@...gle.com>
Subject: Re: [RESEND PATCH] driver core: Clear FWNODE_FLAG_LINKS_ADDED in
 device_links_purge()



On 2023/9/27 16:08, Greg KH wrote:
> On Wed, Sep 27, 2023 at 02:34:43PM +0800, Zhenhua Huang wrote:
>>
>>
>> On 2023/9/27 13:57, Greg KH wrote:
>>> On Wed, Sep 27, 2023 at 10:30:10AM +0800, Zhenhua Huang wrote:
>>>> Flag FWNODE_FLAG_LINKS_ADDED stops fwnode links creation. Current kernel
>>>> only adds it once after fwnode links creation in fw_devlink_parse_fwnode().
>>>> After that even device links being purged, the flag will not be cleared.
>>>>
>>>> Fwnode links are converted to device links and will not be added back
>>>> forever in normal case. Essentially if a device is registered and
>>>> unregisted (also deleted) before it is probed (due to missing fwlink
>>>> dependencies, abort in device_links_check_suppliers), the fwlink is not
>>>> setup next when device is newly created again. This means the probe gets
>>>> called without meeting all dependencies.
>>>>
>>>> It usuallly happens in the case of a glue driver. Of_platform_populate()
>>>> allows us to populate subnodes. We may do it in ancestor node probing
>>>> function, then check subnode's probing status because there may be chances
>>>> that suppliers of subnode are not ready. We may further need to do
>>>> of_platform_depopulate(which purges device links) and in some time
>>>> of_platform_populate() again. Such case we miss fwnode links(so that device
>>>> links) during second time of populating subnodes.
>>>>
>>>> Fix it by Clearing FWNODE_FLAG_LINKS_ADDED flag in purging device link
>>>> func, indicates both fwnode links and device links are absent.
>>>>
>>>> Signed-off-by: Zhenhua Huang <quic_zhenhuah@...cinc.com>
>>>> ---
>>>>    drivers/base/core.c | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/drivers/base/core.c b/drivers/base/core.c
>>>> index b7d7f41..2a1975d 100644
>>>> --- a/drivers/base/core.c
>>>> +++ b/drivers/base/core.c
>>>> @@ -1630,6 +1630,10 @@ static void device_links_purge(struct device *dev)
>>>>    		__device_link_del(&link->kref);
>>>>    	}
>>>> +	/* Clear flags in fwnode. Give a chance to create fwnode link again */
>>>> +	if (dev->fwnode)
>>>> +		dev->fwnode->flags &= ~FWNODE_FLAG_LINKS_ADDED;
>>>> +
>>>>    	device_links_write_unlock();
>>>>    }
>>>> -- 
>>>> 2.7.4
>>>>
>>>
>>> Why is this a RESEND?  What was wrong with the first version?
>>
>> As per request of codes author, I CCed saravanak this time :)
>> Nothing else changed.
> 
> Please state that below the --- line, otherwise we have no idea why this
> was needed, we can't read minds :)

Oh, learnt the tip. Thanks! Next time will pay attention.

> 
> thanks,
> 
> greg k-h

Thanks,
Zhenhua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ