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: <CAJZ5v0jjSoNchvdDacQjakscsSK6d535Ruqd=OR_nYz4nMNwVQ@mail.gmail.com>
Date:   Mon, 30 Jan 2023 19:51:11 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] driver core: soc: remove layering violation for the soc_bus

On Mon, Jan 30, 2023 at 7:49 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> The soc_bus code pokes around in the internal bus structures assuming
> that it "knows" if a field is not set that it has not been registered
> yet.  That isn't a safe assumption, so just remove the layering
> violation entirely and keep track if the bus has been registered or not
> ourselves.
>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

> ---
>  drivers/base/soc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/soc.c b/drivers/base/soc.c
> index 22130b5f789d..0fb1d4ab9d8a 100644
> --- a/drivers/base/soc.c
> +++ b/drivers/base/soc.c
> @@ -30,6 +30,7 @@ struct soc_device {
>  static struct bus_type soc_bus_type = {
>         .name  = "soc",
>  };
> +static bool soc_bus_registered;
>
>  static DEVICE_ATTR(machine,            0444, soc_info_show,  NULL);
>  static DEVICE_ATTR(family,             0444, soc_info_show,  NULL);
> @@ -117,7 +118,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
>         const struct attribute_group **soc_attr_groups;
>         int ret;
>
> -       if (!soc_bus_type.p) {
> +       if (!soc_bus_registered) {
>                 if (early_soc_dev_attr)
>                         return ERR_PTR(-EBUSY);
>                 early_soc_dev_attr = soc_dev_attr;
> @@ -183,6 +184,7 @@ static int __init soc_bus_register(void)
>         ret = bus_register(&soc_bus_type);
>         if (ret)
>                 return ret;
> +       soc_bus_registered = true;
>
>         if (early_soc_dev_attr)
>                 return PTR_ERR(soc_device_register(early_soc_dev_attr));
> --
> 2.39.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ