diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-01-10 00:45:10 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-01-28 14:58:02 -0500 |
commit | f557474ca3a23800dffb790846bcb121fa046c71 (patch) | |
tree | 0a77a92c9d977bc31a35567afab4c2a268eb6436 /drivers/tty/tty_io.c | |
parent | bee6741ca022f051ea1b46e16fb2ff0097643181 (diff) |
tty: Add fasync() hung up file operation
VFS uses a two-stage check-and-call method for invoking file_operations
methods, without explicitly snapshotting either the file_operations ptr
or the function ptr. Since the tty core is one of the few VFS users that
changes the f_op file_operations ptr of the file descriptor (when the
tty has been hung up), and since the likelihood of the compiler generating
a reload of either f_op or the function ptr is basically nil, just define
a hung up fasync() file operation that returns an error.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r-- | drivers/tty/tty_io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 7533ab1abe72..0140c8669ada 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -468,6 +468,11 @@ static long hung_up_tty_compat_ioctl(struct file *file, | |||
468 | return cmd == TIOCSPGRP ? -ENOTTY : -EIO; | 468 | return cmd == TIOCSPGRP ? -ENOTTY : -EIO; |
469 | } | 469 | } |
470 | 470 | ||
471 | static int hung_up_tty_fasync(int fd, struct file *file, int on) | ||
472 | { | ||
473 | return -ENOTTY; | ||
474 | } | ||
475 | |||
471 | static const struct file_operations tty_fops = { | 476 | static const struct file_operations tty_fops = { |
472 | .llseek = no_llseek, | 477 | .llseek = no_llseek, |
473 | .read = tty_read, | 478 | .read = tty_read, |
@@ -500,6 +505,7 @@ static const struct file_operations hung_up_tty_fops = { | |||
500 | .unlocked_ioctl = hung_up_tty_ioctl, | 505 | .unlocked_ioctl = hung_up_tty_ioctl, |
501 | .compat_ioctl = hung_up_tty_compat_ioctl, | 506 | .compat_ioctl = hung_up_tty_compat_ioctl, |
502 | .release = tty_release, | 507 | .release = tty_release, |
508 | .fasync = hung_up_tty_fasync, | ||
503 | }; | 509 | }; |
504 | 510 | ||
505 | static DEFINE_SPINLOCK(redirect_lock); | 511 | static DEFINE_SPINLOCK(redirect_lock); |