Commit fa91418b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tty-5.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty fixes from Greg KH:
 "Here are three small tty_io bugfixes for reported issues that Eric has
  resolved for 5.6-rc7

  All of these have been in linux-next with no reported issues"

* tag 'tty-5.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: fix compat TIOCGSERIAL checking wrong function ptr
  tty: fix compat TIOCGSERIAL leaking uninitialized memory
  tty: drop outdated comments about release_tty() locking
parents 12bf19c9 6e622cd8
...@@ -1589,9 +1589,7 @@ void tty_kclose(struct tty_struct *tty) ...@@ -1589,9 +1589,7 @@ void tty_kclose(struct tty_struct *tty)
tty_debug_hangup(tty, "freeing structure\n"); tty_debug_hangup(tty, "freeing structure\n");
/* /*
* The release_tty function takes care of the details of clearing * The release_tty function takes care of the details of clearing
* the slots and preserving the termios structure. The tty_unlock_pair * the slots and preserving the termios structure.
* should be safe as we keep a kref while the tty is locked (so the
* unlock never unlocks a freed tty).
*/ */
mutex_lock(&tty_mutex); mutex_lock(&tty_mutex);
tty_port_set_kopened(tty->port, 0); tty_port_set_kopened(tty->port, 0);
...@@ -1621,9 +1619,7 @@ void tty_release_struct(struct tty_struct *tty, int idx) ...@@ -1621,9 +1619,7 @@ void tty_release_struct(struct tty_struct *tty, int idx)
tty_debug_hangup(tty, "freeing structure\n"); tty_debug_hangup(tty, "freeing structure\n");
/* /*
* The release_tty function takes care of the details of clearing * The release_tty function takes care of the details of clearing
* the slots and preserving the termios structure. The tty_unlock_pair * the slots and preserving the termios structure.
* should be safe as we keep a kref while the tty is locked (so the
* unlock never unlocks a freed tty).
*/ */
mutex_lock(&tty_mutex); mutex_lock(&tty_mutex);
release_tty(tty, idx); release_tty(tty, idx);
...@@ -2734,9 +2730,11 @@ static int compat_tty_tiocgserial(struct tty_struct *tty, ...@@ -2734,9 +2730,11 @@ static int compat_tty_tiocgserial(struct tty_struct *tty,
struct serial_struct32 v32; struct serial_struct32 v32;
struct serial_struct v; struct serial_struct v;
int err; int err;
memset(&v, 0, sizeof(struct serial_struct));
if (!tty->ops->set_serial) memset(&v, 0, sizeof(v));
memset(&v32, 0, sizeof(v32));
if (!tty->ops->get_serial)
return -ENOTTY; return -ENOTTY;
err = tty->ops->get_serial(tty, &v); err = tty->ops->get_serial(tty, &v);
if (!err) { if (!err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment