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: <20190927181856.GD1804168@kroah.com>
Date:   Fri, 27 Sep 2019 20:18:56 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Dan Streetman <ddstreet@...onical.com>
Cc:     Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Alexey Kardashevskiy <aik@...abs.ru>,
        Rob Herring <robh@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] powerpc/vio: use simple dummy struct device as bus parent

On Fri, Sep 27, 2019 at 09:04:02AM -0400, Dan Streetman wrote:
> The dummy vio_bus_device creates the /sys/devices/vio directory, which
> contains real vio devices under it; since it represents itself as having
> a bus = &vio_bus_type, its /sys/devices/vio/uevent does call the bus's
> .uevent function, vio_hotplug(), and as that function won't find a real
> device for the dummy vio_dev, it will return -ENODEV.
> 
> One of the main users of the uevent node is udevadm, e.g. when it is called
> with 'udevadm trigger --devices'.  Up until recently, it would ignore any
> errors returned when writing to devices' uevent file, but it was recently
> changed to start returning error if it gets an error writing to any uevent
> file:
> https://github.com/systemd/systemd/commit/97afc0351a96e0daa83964df33937967c75c644f
> 
> since the /sys/devices/vio/uevent file has always returned ENODEV from
> any write to it, this now causes the udevadm trigger command to return
> an error.  This may be fixed in udevadm to ignore ENODEV errors, but the
> vio driver should still be fixed.
> 
> This patch changes the arch/powerpc/platform/pseries/vio.c 'dummy'
> parent device into a real dummy device with no .bus, so its uevent
> file will stop returning ENODEV and simply do nothing and return 0.
> 
> Signed-off-by: Dan Streetman <ddstreet@...onical.com>
> ---
>  arch/powerpc/platforms/pseries/vio.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
> index 79e2287991db..63bc16631680 100644
> --- a/arch/powerpc/platforms/pseries/vio.c
> +++ b/arch/powerpc/platforms/pseries/vio.c
> @@ -32,11 +32,8 @@
>  #include <asm/page.h>
>  #include <asm/hvcall.h>
>  
> -static struct vio_dev vio_bus_device  = { /* fake "parent" device */
> -	.name = "vio",
> -	.type = "",
> -	.dev.init_name = "vio",
> -	.dev.bus = &vio_bus_type,
> +static struct device vio_bus = {
> +	.init_name	= "vio",

Eeek, no!  Why are you creating a static device that will then be
reference counted?  Not nice :(

What's wrong with a simple call to device_create() for your "fake"
device you want to make here?  That's what it is there for :)

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ