Commit 3bb76d57 authored by Laura Abbott's avatar Laura Abbott Committed by Greg Kroah-Hartman

n_tty: Fix auditing support for cannonical mode

commit 72586c60 upstream.

Commit 32f13521
("n_tty: Line copy to user buffer in canonical mode")
changed cannonical mode copying to use copy_to_user
but missed adding the call to the audit framework.
Add in the appropriate functions to get audit support.

Fixes: 32f13521 ("n_tty: Line copy to user buffer in canonical mode")
Reported-by: default avatarMiloslav Trmač <mitr@redhat.com>
Signed-off-by: default avatarLaura Abbott <labbott@fedoraproject.org>
Reviewed-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 209abaea
...@@ -186,6 +186,17 @@ static int receive_room(struct tty_struct *tty) ...@@ -186,6 +186,17 @@ static int receive_room(struct tty_struct *tty)
return left; return left;
} }
static inline int tty_copy_to_user(struct tty_struct *tty,
void __user *to,
const void *from,
unsigned long n)
{
struct n_tty_data *ldata = tty->disc_data;
tty_audit_add_data(tty, to, n, ldata->icanon);
return copy_to_user(to, from, n);
}
/** /**
* n_tty_set_room - receive space * n_tty_set_room - receive space
* @tty: terminal * @tty: terminal
...@@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, ...@@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
__func__, eol, found, n, c, size, more); __func__, eol, found, n, c, size, more);
if (n > size) { if (n > size) {
ret = copy_to_user(*b, read_buf_addr(ldata, tail), size); ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size);
if (ret) if (ret)
return -EFAULT; return -EFAULT;
ret = copy_to_user(*b + size, ldata->read_buf, n - size); ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size);
} else } else
ret = copy_to_user(*b, read_buf_addr(ldata, tail), n); ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n);
if (ret) if (ret)
return -EFAULT; return -EFAULT;
......
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