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:   Thu, 12 Jul 2018 11:18:26 +0200
From:   Benjamin Gaignard <benjamin.gaignard@...aro.org>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Mark Brown <broonie@...nel.org>,
        pascal paillet <p.paillet@...com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Benjamin Gaignard <benjamin.gaignard@...com>
Subject: Re: [PATCH] base: core: Remove WARN_ON from link dependencies check

2018-07-12 10:55 GMT+02:00 Greg KH <gregkh@...uxfoundation.org>:
> On Thu, Jul 12, 2018 at 10:06:23AM +0200, Benjamin Gaignard wrote:
>> In some cases the link between between customer and supplier
>> already exist. Do not warn about already existing dependencies
>> because device_link_add() take care of this case.
>
> Why would a link already exist that is asked to be created again?  What
> code path causes this?

It could happen that the link exist because a device use it parent as supplier.
That case has been describe by Marek in this thread (I forgot to add
it in the commit message, sorry):
https://lkml.org/lkml/2018/7/9/356

>
>>
>> Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...com>
>> ---
>>  drivers/base/core.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/core.c b/drivers/base/core.c
>> index df3e1a44707a..fcdc17f0f349 100644
>> --- a/drivers/base/core.c
>> +++ b/drivers/base/core.c
>> @@ -105,7 +105,7 @@ static int device_is_dependent(struct device *dev, void *target)
>>       struct device_link *link;
>>       int ret;
>>
>> -     if (WARN_ON(dev == target))
>> +     if (dev == target)
>>               return 1;
>>
>>       ret = device_for_each_child(dev, target, device_is_dependent);
>> @@ -113,7 +113,7 @@ static int device_is_dependent(struct device *dev, void *target)
>>               return ret;
>>
>>       list_for_each_entry(link, &dev->links.consumers, s_node) {
>> -             if (WARN_ON(link->consumer == target))
>> +             if (link->consumer == target)
>>                       return 1;
>
> Both of these WARN_ON are for valid code?  That feels really odd to me,
> I need more explanation here please.

The documentation of the function is clear about return values:
"Check if @target depends on @dev or any device dependent on it (its
child or ts consumer etc).  Return 1 if that is the case or 0
otherwise."
so, for me, not need to warn user about something that is expected.

Benjamin
>
> thanks,
>
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ