summaryrefslogtreecommitdiff
path: root/drivers/tty/vt/vc_screen.c
AgeCommit message (Collapse)Author
2013-06-29vc: switch to fixed_size_llseek()Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-03-27vt: synchronize_rcu() under spinlock is not nice...Al Viro
vcs_poll_data_free() calls unregister_vt_notifier(), which calls atomic_notifier_chain_unregister(), which calls synchronize_rcu(). Do it *after* we'd dropped ->f_lock. Cc: stable@vger.kernel.org (all kernels since 2.6.37) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-02-23new helper: file_inode(file)Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-03-08vt: push down the tty lock so we can see what is left to tackleAlan Cox
At this point we have the tty_lock guarding a couple of oddities, plus the translation and unimap still. We also extend the console_lock in a couple of spots where coverage is wrong and switch vcs_open to use the right lock ! [Fixed the locking issue Jiri reported] Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2011-10-31tty: Add export.h for EXPORT_SYMBOL/THIS_MODULE to exportersPaul Gortmaker
With module.h being implicitly everywhere via device.h, the absence of explicitly including something for EXPORT_SYMBOL went unnoticed. Since we are heading to fix things up and clean module.h from the device.h file, we need to explicitly include these files now. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-04-19tty: remove invalid location line in file headerJovi Zhang
remove invalid location line in each file header after location moved from driver/char to driver/tty Signed-off-by: Jovi Zhang <bookjovi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-17Merge branch 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bklLinus Torvalds
* 'config' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl: BKL: That's all, folks fs/locks.c: Remove stale FIXME left over from BKL conversion ipx: remove the BKL appletalk: remove the BKL x25: remove the BKL ufs: remove the BKL hpfs: remove the BKL drivers: remove extraneous includes of smp_lock.h tracing: don't trace the BKL adfs: remove the big kernel lock
2011-03-01drivers: remove extraneous includes of smp_lock.hArnd Bergmann
These were missed the last time I cleaned this up globally, because of code moving around or new code getting merged. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2011-02-17tty,vcs removing con_buf/conf_buf_mtxJiri Olsa
seems there's no longer need for using con_buf/conf_buf_mtx as vcs_read/vcs_write buffer for user's data. The do_con_write function, that was the other user of this, is currently using its own kmalloc-ed buffer. Not sure when this got changed, as I was able to find this code in 2.6.9, but it's already gone as far as current git history goes - 2.6.12-rc2. AFAICS there's a behaviour change with the current change. The lseek is not completely mutually exclusive with the vcs_read/vcs_write - the file->f_pos might get updated via lseek callback during the vcs_read/vcs_write processing. I tried to find out if the prefered behaviour is to keep this in sync within read/write/lseek functions, but I did not find any pattern on different places. I guess if user end up calling write/lseek from different threads she should know what she's doing. If needed we could use dedicated fd mutex/buffer. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-02-17tty,vcs: lseek/VC-release race fixJiri Olsa
there's a race between vcs's lseek handler and VC release. The lseek handler does not hold console_lock and touches VC's size info. If during this the VC got released, there's an access violation. Following program triggers the issue for me: [SNIP] #define _BSD_SOURCE #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/vt.h> #include <unistd.h> #include <errno.h> static int run_seek(void) { while(1) { int fd; fd = open("./vcs30", O_RDWR); while(lseek(fd, 0, 0) != -1); close(fd); } } static int open_ioctl_tty(void) { return open("/dev/tty1", O_RDWR); } static int do_ioctl(int fd, int req, int i) { return ioctl(fd, req, i); } #define INIT(i) do_ioctl(ioctl_fd, VT_ACTIVATE, i) #define SHUT(i) do_ioctl(ioctl_fd, VT_DISALLOCATE, i) int main(int argc, char **argv) { int ioctl_fd = open_ioctl_tty(); if (ioctl < 0) { perror("open tty1 failed\n"); return -1; } if ((-1 == mknod("vcs30", S_IFCHR|0666, makedev(7, 30))) && (errno != EEXIST)) { printf("errno %d\n", errno); perror("failed to create vcs30"); return -1; } do_ioctl(ioctl_fd, VT_LOCKSWITCH, 0); if (!fork()) run_seek(); while(1) { INIT(30); SHUT(30); } return 0; } [SNIP] Signed-off-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-26console: rename acquire/release_console_sem() to console_lock/unlock()Torben Hohn
The -rt patches change the console_semaphore to console_mutex. As a result, a quite large chunk of the patches changes all acquire/release_console_sem() to acquire/release_console_mutex() This commit makes things use more neutral function names which dont make implications about the underlying lock. The only real change is the return value of console_trylock which is inverted from try_acquire_console_sem() This patch also paves the way to switching console_sem from a semaphore to a mutex. [akpm@linux-foundation.org: coding-style fixes] [akpm@linux-foundation.org: make console_trylock return 1 on success, per Geert] Signed-off-by: Torben Hohn <torbenh@gmx.de> Cc: Thomas Gleixner <tglx@tglx.de> Cc: Greg KH <gregkh@suse.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-11-11vcs: make proper usage of the poll flagsNicolas Pitre
Kay Sievers pointed out that usage of POLLIN is well defined by POSIX, and the current usage here doesn't follow that definition. So let's duplicate the same semantics as implemented by sysfs_poll() instead. Signed-off-by: Nicolas Pitre <nicolas.pitre@canonical.com> Acked-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-11-05TTY: create drivers/tty/vt and move the vt code thereGreg Kroah-Hartman
The vt and other related code is moved into the drivers/tty/vt directory. Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>