aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-03-03 16:23:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-03-03 16:23:03 -0500
commit56a79b7b021bf1b08334e63c2c14b280e2dbf47a (patch)
tree0419233e6194f4f12073c9284852885aa8984bec /drivers/tty
parent1c82315a12144cde732636e259d39e3ee81b3c5b (diff)
parentdcf787f39162ce32ca325b3e784aba2d2444619a (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more VFS bits from Al Viro: "Unfortunately, it looks like xattr series will have to wait until the next cycle ;-/ This pile contains 9p cleanups and fixes (races in v9fs_fid_add() etc), fixup for nommu breakage in shmem.c, several cleanups and a bit more file_inode() work" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: constify path_get/path_put and fs_struct.c stuff fix nommu breakage in shmem.c cache the value of file_inode() in struct file 9p: if v9fs_fid_lookup() gets to asking server, it'd better have hashed dentry 9p: make sure ->lookup() adds fid to the right dentry 9p: untangle ->lookup() a bit 9p: double iput() in ->lookup() if d_materialise_unique() fails 9p: v9fs_fid_add() can't fail now v9fs: get rid of v9fs_dentry 9p: turn fid->dlist into hlist 9p: don't bother with private lock in ->d_fsdata; dentry->d_lock will do just fine more file_inode() open-coded instances selinux: opened file can't have NULL or negative ->f_path.dentry (In the meantime, the hlist traversal macros have changed, so this required a semantic conflict fixup for the newly hlistified fid->dlist)
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/tty_io.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index fd473639ab70..05400acbc456 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -960,11 +960,10 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
960 loff_t *ppos) 960 loff_t *ppos)
961{ 961{
962 int i; 962 int i;
963 struct inode *inode = file->f_path.dentry->d_inode;
964 struct tty_struct *tty = file_tty(file); 963 struct tty_struct *tty = file_tty(file);
965 struct tty_ldisc *ld; 964 struct tty_ldisc *ld;
966 965
967 if (tty_paranoia_check(tty, inode, "tty_read")) 966 if (tty_paranoia_check(tty, file_inode(file), "tty_read"))
968 return -EIO; 967 return -EIO;
969 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags))) 968 if (!tty || (test_bit(TTY_IO_ERROR, &tty->flags)))
970 return -EIO; 969 return -EIO;
@@ -1132,12 +1131,11 @@ void tty_write_message(struct tty_struct *tty, char *msg)
1132static ssize_t tty_write(struct file *file, const char __user *buf, 1131static ssize_t tty_write(struct file *file, const char __user *buf,
1133 size_t count, loff_t *ppos) 1132 size_t count, loff_t *ppos)
1134{ 1133{
1135 struct inode *inode = file->f_path.dentry->d_inode;
1136 struct tty_struct *tty = file_tty(file); 1134 struct tty_struct *tty = file_tty(file);
1137 struct tty_ldisc *ld; 1135 struct tty_ldisc *ld;
1138 ssize_t ret; 1136 ssize_t ret;
1139 1137
1140 if (tty_paranoia_check(tty, inode, "tty_write")) 1138 if (tty_paranoia_check(tty, file_inode(file), "tty_write"))
1141 return -EIO; 1139 return -EIO;
1142 if (!tty || !tty->ops->write || 1140 if (!tty || !tty->ops->write ||
1143 (test_bit(TTY_IO_ERROR, &tty->flags))) 1141 (test_bit(TTY_IO_ERROR, &tty->flags)))
@@ -2047,7 +2045,7 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)
2047 struct tty_ldisc *ld; 2045 struct tty_ldisc *ld;
2048 int ret = 0; 2046 int ret = 0;
2049 2047
2050 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_poll")) 2048 if (tty_paranoia_check(tty, file_inode(filp), "tty_poll"))
2051 return 0; 2049 return 0;
2052 2050
2053 ld = tty_ldisc_ref_wait(tty); 2051 ld = tty_ldisc_ref_wait(tty);
@@ -2063,7 +2061,7 @@ static int __tty_fasync(int fd, struct file *filp, int on)
2063 unsigned long flags; 2061 unsigned long flags;
2064 int retval = 0; 2062 int retval = 0;
2065 2063
2066 if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync")) 2064 if (tty_paranoia_check(tty, file_inode(filp), "tty_fasync"))
2067 goto out; 2065 goto out;
2068 2066
2069 retval = fasync_helper(fd, filp, on, &tty->fasync); 2067 retval = fasync_helper(fd, filp, on, &tty->fasync);
@@ -2637,9 +2635,8 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2637 void __user *p = (void __user *)arg; 2635 void __user *p = (void __user *)arg;
2638 int retval; 2636 int retval;
2639 struct tty_ldisc *ld; 2637 struct tty_ldisc *ld;
2640 struct inode *inode = file->f_dentry->d_inode;
2641 2638
2642 if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2639 if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl"))
2643 return -EINVAL; 2640 return -EINVAL;
2644 2641
2645 real_tty = tty_pair_get_tty(tty); 2642 real_tty = tty_pair_get_tty(tty);
@@ -2780,12 +2777,11 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2780static long tty_compat_ioctl(struct file *file, unsigned int cmd, 2777static long tty_compat_ioctl(struct file *file, unsigned int cmd,
2781 unsigned long arg) 2778 unsigned long arg)
2782{ 2779{
2783 struct inode *inode = file->f_dentry->d_inode;
2784 struct tty_struct *tty = file_tty(file); 2780 struct tty_struct *tty = file_tty(file);
2785 struct tty_ldisc *ld; 2781 struct tty_ldisc *ld;
2786 int retval = -ENOIOCTLCMD; 2782 int retval = -ENOIOCTLCMD;
2787 2783
2788 if (tty_paranoia_check(tty, inode, "tty_ioctl")) 2784 if (tty_paranoia_check(tty, file_inode(file), "tty_ioctl"))
2789 return -EINVAL; 2785 return -EINVAL;
2790 2786
2791 if (tty->ops->compat_ioctl) { 2787 if (tty->ops->compat_ioctl) {