remarkable-linux/drivers
Nick Piggin d996b62a8d tty: fix fu_list abuse
tty: fix fu_list abuse

tty code abuses fu_list, which causes a bug in remount,ro handling.

If a tty device node is opened on a filesystem, then the last link to the inode
removed, the filesystem will be allowed to be remounted readonly. This is
because fs_may_remount_ro does not find the 0 link tty inode on the file sb
list (because the tty code incorrectly removed it to use for its own purpose).
This can result in a filesystem with errors after it is marked "clean".

Taking idea from Christoph's initial patch, allocate a tty private struct
at file->private_data and put our required list fields in there, linking
file and tty. This makes tty nodes behave the same way as other device nodes
and avoid meddling with the vfs, and avoids this bug.

The error handling is not trivial in the tty code, so for this bugfix, I take
the simple approach of using __GFP_NOFAIL and don't worry about memory errors.
This is not a problem because our allocator doesn't fail small allocs as a rule
anyway. So proper error handling is left as an exercise for tty hackers.

[ Arguably filesystem's device inode would ideally be divorced from the
driver's pseudo inode when it is opened, but in practice it's not clear whether
that will ever be worth implementing. ]

Cc: linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-08-18 08:35:47 -04:00
..
accessibility
acpi Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2010-08-15 17:37:07 -07:00
amba
ata Merge branch 'linus' into release 2010-08-15 01:06:31 -04:00
atm Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
auxdisplay
base
block Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
bluetooth
cdrom
char tty: fix fu_list abuse 2010-08-18 08:35:47 -04:00
clocksource
connector
cpufreq
cpuidle
crypto [S390] zcrypt: fix Kconfig dependencies 2010-08-13 10:06:54 +02:00
dca
dio
dma Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
edac Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
eisa
firewire
firmware Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-14 12:34:34 -07:00
gpio gpiolib: Implement set_debounce for WM831x GPIOs 2010-08-12 11:27:57 +02:00
gpu Merge git://git.infradead.org/~dwmw2/ideapad-2.6 2010-08-13 18:04:52 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-08-10 15:08:02 -07:00
hwmon hwmon: (via-cputemp) Remove bogus "SHOW" global variable 2010-08-14 21:09:02 +02:00
i2c Merge branch 'for-linus/i2c-2636' of git://git.fluff.org/bjdooks/linux 2010-08-14 11:57:54 -07:00
ide ide: use module_param_named rather than module_param_call 2010-08-11 23:04:39 +09:30
idle Merge branch 'idle-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6 2010-08-15 11:17:52 -07:00
ieee1394
ieee802154
infiniband Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
input Input: fix faulty XXinput_* calls 2010-08-13 12:03:24 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-08-13 10:38:12 -07:00
leds Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
lguest
macintosh Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2010-08-12 10:06:29 -07:00
mca
md dm mpath: support discard 2010-08-12 04:14:32 +01:00
media v4l: Remove reference to bkl ioctl in compat ioctl handling 2010-08-14 00:24:24 +02:00
memstick memstick: fix hangs on unexpected device removal in mspro_blk 2010-08-12 08:43:31 -07:00
message fusion: add function parameter names to kernel-doc 2010-08-14 16:21:00 -07:00
mfd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6 2010-08-12 10:01:30 -07:00
misc Merge branch 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2010-08-12 10:01:59 -07:00
mmc Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6 2010-08-14 11:54:09 -07:00
mtd Merge git://git.infradead.org/mtd-2.6 2010-08-15 17:32:47 -07:00
net pcmcia: xirc2ps_cs bugfix 2010-08-13 16:55:26 -07:00
nubus
of
oprofile
parisc
parport Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
pci Merge git://git.infradead.org/iommu-2.6 2010-08-15 17:34:20 -07:00
pcmcia Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
platform ideapad: Only allow camera state to be set to 0 or 1 2010-08-11 18:00:52 +01:00
pnp
power Merge git://git.infradead.org/battery-2.6 2010-08-12 09:58:33 -07:00
pps
ps3
rapidio
regulator regulator: Remove default DEBUG define from TPS6586x 2010-08-11 11:38:03 +01:00
rtc Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
s390 Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6 2010-08-13 10:54:04 -07:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-14 12:34:34 -07:00
serial Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-12 09:11:31 -07:00
sfi
sh
sn
spi Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6 2010-08-14 11:54:09 -07:00
ssb
staging fs: fs_struct rwlock to spinlock 2010-08-18 08:35:46 -04:00
tc
telephony
thermal
uio
usb Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2010-08-12 10:06:29 -07:00
uwb
vhost
video Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2010-08-12 10:06:29 -07:00
virtio
vlynq
w1
watchdog watchdog: hpwdt (12/12): Make NMI decoding a compile-time option 2010-08-13 20:54:53 +00:00
xen Merge branch 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2010-08-12 09:09:41 -07:00
zorro
Kconfig
Makefile