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: <9b41eb05-a095-39af-8b76-a73fa2532e92@redhat.com>
Date:   Fri, 19 Nov 2021 09:32:32 +0100
From:   Javier Martinez Canillas <javierm@...hat.com>
To:     Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        Mark Brown <broonie@...nel.org>
Cc:     linux-spi@...r.kernel.org, kernel@...gutronix.de,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spidev: Make probe to fail early if a spidev compatible
 is used

Hello Uwe,

On 11/19/21 08:40, Uwe Kleine-König wrote:

[snip]

> 
> It affects c) only if the device tree has a device with compatible =
> "spidev". For such a device the history is:
>
>   - Before 956b200a846e ("spi: spidev: Warn loudly if instantiated from
>     DT as "spidev"") in v4.1-rc1:
>     Just bound silently
> 
>   - After 956b200a846e up to 6840615f85f6 ("spi: spidev: Add SPI ID
>     table") in v5.15-rc6:
>     The device was automatically bound with a warning
> 
>   - After 6840615f85f6:
>     The device doesn't bind automatically, when using driver_override
>     you get a warning.
> 
>   - With the proposed patch:
>     The device cannot be bound even using driver_override
>

My understanding is that there's an agreement that using "spidev" as the
specific compatible string is something that should not be supported.
 
> Not this affects also devices that use
> 
> 	compatible = "myvender,devicename", "spidev";
> 

This is indeed a corner case and I'm less sure what the kernel should do
about it. I just learned now that of_device_is_compatible() return value
is not a boolean but instead a "score":

https://elixir.bootlin.com/linux/latest/source/drivers/of/base.c#L455

I wonder if we could add another helper that returns the index instead,
and do: of_device_is_compatible_index(spi->dev.of_node, "spidev") == 0

Another option is to add an of_device_is_compatible_specific() helper.

Or just consider DT nodes with a general "spidev" compatible string to
also not be valid. I would lean towards this one I think.

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ