aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-10 01:55:26 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-27 19:41:04 -0500
commiteab25a5cd1f91b5c7991affe95f24ce188b8021f (patch)
tree8efd0ba7f8f17d89c08503b224c959fa92ef2a00
parentd7c0ba40ebb32510e2c5d80a392474320cab8a2d (diff)
tty: audit: Never audit packet mode
tty audit never logs pty master reads, but packet mode only works for pty masters, so tty_audit_add_data() was never logging packet mode anyway. Don't audit packet mode data. As those are the lone call sites, remove tty_put_user(). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/n_tty.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index f4555a261420..bacafda44bf3 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -153,15 +153,6 @@ static inline unsigned char *echo_buf_addr(struct n_tty_data *ldata, size_t i)
153 return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)]; 153 return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)];
154} 154}
155 155
156static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
157 unsigned char __user *ptr)
158{
159 struct n_tty_data *ldata = tty->disc_data;
160
161 tty_audit_add_data(tty, &x, 1, ldata->icanon);
162 return put_user(x, ptr);
163}
164
165static int tty_copy_to_user(struct tty_struct *tty, void __user *to, 156static int tty_copy_to_user(struct tty_struct *tty, void __user *to,
166 size_t tail, size_t n) 157 size_t tail, size_t n)
167{ 158{
@@ -2197,11 +2188,11 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
2197 cs = tty->link->ctrl_status; 2188 cs = tty->link->ctrl_status;
2198 tty->link->ctrl_status = 0; 2189 tty->link->ctrl_status = 0;
2199 spin_unlock_irq(&tty->link->ctrl_lock); 2190 spin_unlock_irq(&tty->link->ctrl_lock);
2200 if (tty_put_user(tty, cs, b++)) { 2191 if (put_user(cs, b)) {
2201 retval = -EFAULT; 2192 retval = -EFAULT;
2202 b--;
2203 break; 2193 break;
2204 } 2194 }
2195 b++;
2205 nr--; 2196 nr--;
2206 break; 2197 break;
2207 } 2198 }
@@ -2247,11 +2238,11 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
2247 2238
2248 /* Deal with packet mode. */ 2239 /* Deal with packet mode. */
2249 if (packet && b == buf) { 2240 if (packet && b == buf) {
2250 if (tty_put_user(tty, TIOCPKT_DATA, b++)) { 2241 if (put_user(TIOCPKT_DATA, b)) {
2251 retval = -EFAULT; 2242 retval = -EFAULT;
2252 b--;
2253 break; 2243 break;
2254 } 2244 }
2245 b++;
2255 nr--; 2246 nr--;
2256 } 2247 }
2257 2248