lkml.org 
[lkml]   [2016]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/3] spi: spidev: create spidev device for all spi slaves.
On Tue, Jul 19, 2016 at 12:35:40AM +0200, Michal Suchanek wrote:

> config SPI_SPIDEV
> - tristate "User mode SPI device driver support"
> + bool "User mode SPI device driver support"

This is a step back, it would require spidev to be built in.

> - spin_lock_irq(&spidev->spi_lock);
> - spi = spi_dev_get(spidev->spi);
> - spin_unlock_irq(&spidev->spi_lock);
> + spi = filp->private_data;
> + spi = spi_dev_get(spi);

All this refactoring to move spidev about should've been a separate
patch, it's hard to find the actual content in here.

> - mutex_lock(&device_list_lock);
> + dev = bus_find_device(&spi_bus_type, NULL, (void *) inode->i_rdev,
> + spidev_devt_match);

...

> - dev_dbg(&spidev->spi->dev, "open/ENOMEM\n");
> + spi = to_spi_device(dev);
> +
> + mutex_lock(&spi->buf_lock);
> + spin_lock_irq(&spi->spidev_lock);
> + spi->spidev_users++;
> + spin_unlock_irq(&spi->spidev_lock);

This is broken, it will unconditionally create a spidev for any chip
select regardless of if there's any actual hardware there and (even more
importantly) regardless if that hardware is actually a SPI device. This
is not safe, especially given some of the ideas people seem to have for
userspaces.

I am getting completely fed up of saying this, it's not OK to just
expose pins to userspace when we have no idea what they are connected
to.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-07-19 01:41    [W:4.497 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site