mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-03 13:53:48 +00:00
tty: warn on deprecated serial flags
When somebody calls TIOCSSERIAL ioctl with serial flags to set one of * ASYNC_SESSION_LOCKOUT * ASYNC_PGRP_LOCKOUT * ASYNC_CALLOUT_NOHUP * ASYNC_AUTOPROBE nothing happens. We actually ignore the flags for over a decade at least (I checked 2.6.0). So start yelling at users who use those flags, that they shouldn't. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d7685ca7c4
commit
8a8ae62f82
2 changed files with 23 additions and 0 deletions
|
@ -2760,6 +2760,24 @@ static int tty_tiocgicount(struct tty_struct *tty, void __user *arg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tty_warn_deprecated_flags(struct serial_struct __user *ss)
|
||||||
|
{
|
||||||
|
static DEFINE_RATELIMIT_STATE(depr_flags,
|
||||||
|
DEFAULT_RATELIMIT_INTERVAL,
|
||||||
|
DEFAULT_RATELIMIT_BURST);
|
||||||
|
char comm[TASK_COMM_LEN];
|
||||||
|
int flags;
|
||||||
|
|
||||||
|
if (get_user(flags, &ss->flags))
|
||||||
|
return;
|
||||||
|
|
||||||
|
flags &= ASYNC_DEPRECATED;
|
||||||
|
|
||||||
|
if (flags && __ratelimit(&depr_flags))
|
||||||
|
pr_warning("%s: '%s' is using deprecated serial flags (with no effect): %.8x\n",
|
||||||
|
__func__, get_task_comm(comm, current), flags);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if pty, return the slave side (real_tty)
|
* if pty, return the slave side (real_tty)
|
||||||
* otherwise, return self
|
* otherwise, return self
|
||||||
|
@ -2903,6 +2921,9 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TIOCSSERIAL:
|
||||||
|
tty_warn_deprecated_flags(p);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (tty->ops->ioctl) {
|
if (tty->ops->ioctl) {
|
||||||
retval = tty->ops->ioctl(tty, cmd, arg);
|
retval = tty->ops->ioctl(tty, cmd, arg);
|
||||||
|
|
|
@ -64,6 +64,8 @@
|
||||||
#define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER)
|
#define ASYNC_MAGIC_MULTIPLIER (1U << ASYNCB_MAGIC_MULTIPLIER)
|
||||||
|
|
||||||
#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
|
#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
|
||||||
|
#define ASYNC_DEPRECATED (ASYNC_SESSION_LOCKOUT | ASYNC_PGRP_LOCKOUT | \
|
||||||
|
ASYNC_CALLOUT_NOHUP | ASYNC_AUTOPROBE)
|
||||||
#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
|
#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
|
||||||
ASYNC_LOW_LATENCY)
|
ASYNC_LOW_LATENCY)
|
||||||
#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
|
#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
|
||||||
|
|
Loading…
Add table
Reference in a new issue