diff options
author | Laura Abbott <labbott@fedoraproject.org> | 2015-05-14 14:42:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-31 18:11:04 -0400 |
commit | 72586c6061ab8c23ffd9f301ed19782a44ff5f04 (patch) | |
tree | f55011b89822d45c182982990d37cffa1791234f | |
parent | 9809889c708ebffe240608eef39b667082f2c945 (diff) |
n_tty: Fix auditing support for cannonical mode
Commit 32f13521ca68bc624ff6effc77f308a52b038bf0
("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: 32f13521ca68 ("n_tty: Line copy to user buffer in canonical mode")
Reported-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/n_tty.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 759604e57b24..396344cb011f 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -162,6 +162,17 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x, | |||
162 | return put_user(x, ptr); | 162 | return put_user(x, ptr); |
163 | } | 163 | } |
164 | 164 | ||
165 | static inline int tty_copy_to_user(struct tty_struct *tty, | ||
166 | void __user *to, | ||
167 | const void *from, | ||
168 | unsigned long n) | ||
169 | { | ||
170 | struct n_tty_data *ldata = tty->disc_data; | ||
171 | |||
172 | tty_audit_add_data(tty, to, n, ldata->icanon); | ||
173 | return copy_to_user(to, from, n); | ||
174 | } | ||
175 | |||
165 | /** | 176 | /** |
166 | * n_tty_kick_worker - start input worker (if required) | 177 | * n_tty_kick_worker - start input worker (if required) |
167 | * @tty: terminal | 178 | * @tty: terminal |
@@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2084 | __func__, eol, found, n, c, size, more); | 2095 | __func__, eol, found, n, c, size, more); |
2085 | 2096 | ||
2086 | if (n > size) { | 2097 | if (n > size) { |
2087 | ret = copy_to_user(*b, read_buf_addr(ldata, tail), size); | 2098 | ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size); |
2088 | if (ret) | 2099 | if (ret) |
2089 | return -EFAULT; | 2100 | return -EFAULT; |
2090 | ret = copy_to_user(*b + size, ldata->read_buf, n - size); | 2101 | ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size); |
2091 | } else | 2102 | } else |
2092 | ret = copy_to_user(*b, read_buf_addr(ldata, tail), n); | 2103 | ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n); |
2093 | 2104 | ||
2094 | if (ret) | 2105 | if (ret) |
2095 | return -EFAULT; | 2106 | return -EFAULT; |