[PATCH] Remove attempt by intel-spi-pci to turn the SPI flash chip writeable

Daniel Gutson daniel at eclypsium.com
Mon Aug 3 10:21:59 EDT 2020

On Mon, Aug 3, 2020 at 10:55 AM Arnd Bergmann <arnd at arndb.de> wrote:
> On Mon, Aug 3, 2020 at 3:45 PM Daniel Gutson
> <daniel.gutson at eclypsium.com> wrote:
> > However, this flag applies only for a number of devices, coming from the
> > platform driver, whereas the devices detected through the PCI driver
> > (intel-spi-pci) are not subject to this check since the configuration
> > takes place in intel-spi-pci which doesn't have an argument.
> This part of the description sounds wrong: the current behavior is that
> the BIOS setting is ignored for PCI devices and it only uses the module
> parameter, the same way as it does for the platform driver.

Actually, the BIOS setting is not ignored, since it is not bypassable.
There is a lock in the BIOS setting, that, if enabled no matter what the
driver does, it will be still read only. However, if that lock is not set,
the SPI chip will be writable because of the driver. That's why
I say 'attempts'.
The intel-spi-pci driver doesn't have a module parameter, and that's
why it unconditionally attempts to turn the chip writable (it will succeed
if it is not locked).
What I did was just left the intel-spi-pci driver without any module parameter,
as it currently is, but removed the part where it attempts to turn the chip
writable (just in case the BIOS is not locked).

> With your patch, both the BIOS setting and the module parameter
> have to explicitly allow writing on PCI devices, while at least for Bay
> Trail platform devices the BIOS write protection is still ignored.
> It sounds like this is what you want, but you should update the description
> accordingly.
>       Arnd

Daniel Gutson
Argentina Site Director
Enginieering Director

Below The Surface: Get the latest threat research and insights on
firmware and supply chain threats from the research team at Eclypsium.

More information about the linux-mtd mailing list