Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f557474c authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman
Browse files

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: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bee6741c
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -468,6 +468,11 @@ static long hung_up_tty_compat_ioctl(struct file *file,
	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
	return cmd == TIOCSPGRP ? -ENOTTY : -EIO;
}
}


static int hung_up_tty_fasync(int fd, struct file *file, int on)
{
	return -ENOTTY;
}

static const struct file_operations tty_fops = {
static const struct file_operations tty_fops = {
	.llseek		= no_llseek,
	.llseek		= no_llseek,
	.read		= tty_read,
	.read		= tty_read,
@@ -500,6 +505,7 @@ static const struct file_operations hung_up_tty_fops = {
	.unlocked_ioctl	= hung_up_tty_ioctl,
	.unlocked_ioctl	= hung_up_tty_ioctl,
	.compat_ioctl	= hung_up_tty_compat_ioctl,
	.compat_ioctl	= hung_up_tty_compat_ioctl,
	.release	= tty_release,
	.release	= tty_release,
	.fasync		= hung_up_tty_fasync,
};
};


static DEFINE_SPINLOCK(redirect_lock);
static DEFINE_SPINLOCK(redirect_lock);