spi: remove some spidev oops-on-rmmod paths
authorDavid Brownell <david-b@pacbell.net>
Fri, 23 May 2008 20:05:03 +0000 (13:05 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 24 May 2008 16:56:14 +0000 (09:56 -0700)
commit25d5cb4b0375e5864ec0ccf35e12ff1d1b5cf3f0
tree0d83e4176f9a8178a98631097fbf839a53702d94
parent5c02b575780d0d785815a1e7b79a98edddee895a
spi: remove some spidev oops-on-rmmod paths

Somehow the spidev code forgot to include a critical mechanism: when the
underlying device is removed (e.g.  spi_master rmmod), open file
descriptors must be prevented from issuing new I/O requests to that
device.  On penalty of the oopsing reported by Sebastian Siewior
<bigeasy@tglx.de> ...

This is a partial fix, adding handshaking between the lower level (SPI
messaging) and the file operations using the spi_dev.  (It also fixes an
issue where reads and writes didn't return the number of bytes sent or
received.)

There's still a refcounting issue to be addressed (separately).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Reported-by: Sebastian Siewior <bigeasy@tglx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/spi/spidev.c