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, 6 Jul 2022 21:51:34 -0700
From:   Saravana Kannan <saravanak@...gle.com>
To:     Abel Vesa <abel.vesa@...aro.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        linux-arm-msm@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC v2] driver core: Fix repeated device_is_dependent check for
 same link

On Wed, Jul 6, 2022 at 8:54 AM Abel Vesa <abel.vesa@...aro.org> wrote:
>
> In case of a cyclic dependency, if the supplier is not yet available,
> the parent of the supplier is checked for dependency. But if there are
> more than one suppliers with the same parent, the first check returns
> true while the next ones skip that specific link entirely because of
> having DL_FLAG_MANAGED and DL_FLAG_SYNC_STATE_ONLY set, which is what
> the relaxing of the link does. But if we check for the target being
> a consumer before the check for those flags, we can check as many
> times as needed the same link and it will always return true, This is
> safe to do, since the relaxing of the link will be done only once
> because those flags will be set and it will bail early.
>
> Signed-off-by: Abel Vesa <abel.vesa@...aro.org>
> ---
>  drivers/base/core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 753e7cca0f40..2c3b860dfe80 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -297,13 +297,13 @@ int device_is_dependent(struct device *dev, void *target)
>                 return ret;
>
>         list_for_each_entry(link, &dev->links.consumers, s_node) {
> +               if (link->consumer == target)
> +                       return 1;
> +
>                 if ((link->flags & ~DL_FLAG_INFERRED) ==
>                     (DL_FLAG_SYNC_STATE_ONLY | DL_FLAG_MANAGED))
>                         continue;

Thanks for trying to fix this issue, but I'll have to Nack this patch.

The whole point of the SYNC_STATE_ONLY flag is to allow cycles. It's
needed to maintain correctness of sync_state(). I think I described
those in the commit text that added the SYNC_STATE_ONLY flag. Check it
out if you are interested. So this change of yours will break
sync_state() functionality.

There's a bunch of nuance to fixing the dual cycle issue and I don't
mind fixing this myself in a week or two if you can wait.

Thanks,
Saravana

>
> -               if (link->consumer == target)
> -                       return 1;
> -
>                 ret = device_is_dependent(link->consumer, target);
>                 if (ret)
>                         break;
> --
> 2.34.3
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ