|
|
a7c7ac3 |
From: Laura Abbott <labbott@fedoraproject.org>
|
|
|
a7c7ac3 |
Date: Wed, 13 May 2015 17:03:06 -0700
|
|
|
a7c7ac3 |
Subject: [PATCH] n_tty: Fix auditing support for cannonical mode
|
|
|
a7c7ac3 |
MIME-Version: 1.0
|
|
|
a7c7ac3 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a7c7ac3 |
Content-Transfer-Encoding: 8bit
|
|
|
a7c7ac3 |
|
|
|
a7c7ac3 |
Commit 32f13521ca68bc624ff6effc77f308a52b038bf0
|
|
|
a7c7ac3 |
("n_tty: Line copy to user buffer in canonical mode")
|
|
|
a7c7ac3 |
changed cannonical mode copying to use copy_to_user
|
|
|
a7c7ac3 |
but missed adding the call to the audit framework.
|
|
|
a7c7ac3 |
Add in the appropriate functions to get audit support.
|
|
|
a7c7ac3 |
|
|
|
a7c7ac3 |
Fixes: 32f13521ca68 ("n_tty: Line copy to user buffer in canonical mode")
|
|
|
a7c7ac3 |
Reported-by: Miloslav Trma─Ź <mitr@redhat.com>
|
|
|
a7c7ac3 |
Signed-off-by: Laura Abbott <labbott@fedoraproject.org>
|
|
|
a7c7ac3 |
---
|
|
|
a7c7ac3 |
drivers/tty/n_tty.c | 17 ++++++++++++++---
|
|
|
a7c7ac3 |
1 file changed, 14 insertions(+), 3 deletions(-)
|
|
|
a7c7ac3 |
|
|
|
a7c7ac3 |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
|
|
|
a7c7ac3 |
index cc57a3a6b02b..eee40b5cb025 100644
|
|
|
a7c7ac3 |
--- a/drivers/tty/n_tty.c
|
|
|
a7c7ac3 |
+++ b/drivers/tty/n_tty.c
|
|
|
a7c7ac3 |
@@ -162,6 +162,17 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
|
|
|
a7c7ac3 |
return put_user(x, ptr);
|
|
|
a7c7ac3 |
}
|
|
|
a7c7ac3 |
|
|
|
a7c7ac3 |
+static inline int tty_copy_to_user(struct tty_struct *tty,
|
|
|
a7c7ac3 |
+ void __user *to,
|
|
|
a7c7ac3 |
+ const void *from,
|
|
|
a7c7ac3 |
+ unsigned long n)
|
|
|
a7c7ac3 |
+{
|
|
|
a7c7ac3 |
+ struct n_tty_data *ldata = tty->disc_data;
|
|
|
a7c7ac3 |
+
|
|
|
a7c7ac3 |
+ tty_audit_add_data(tty, to, n, ldata->icanon);
|
|
|
a7c7ac3 |
+ return copy_to_user(to, from, n);
|
|
|
a7c7ac3 |
+}
|
|
|
a7c7ac3 |
+
|
|
|
a7c7ac3 |
/**
|
|
|
a7c7ac3 |
* n_tty_kick_worker - start input worker (if required)
|
|
|
a7c7ac3 |
* @tty: terminal
|
|
|
a7c7ac3 |
@@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
|
|
|
a7c7ac3 |
__func__, eol, found, n, c, size, more);
|
|
|
a7c7ac3 |
|
|
|
a7c7ac3 |
if (n > size) {
|
|
|
a7c7ac3 |
- ret = copy_to_user(*b, read_buf_addr(ldata, tail), size);
|
|
|
a7c7ac3 |
+ ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size);
|
|
|
a7c7ac3 |
if (ret)
|
|
|
a7c7ac3 |
return -EFAULT;
|
|
|
a7c7ac3 |
- ret = copy_to_user(*b + size, ldata->read_buf, n - size);
|
|
|
a7c7ac3 |
+ ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size);
|
|
|
a7c7ac3 |
} else
|
|
|
a7c7ac3 |
- ret = copy_to_user(*b, read_buf_addr(ldata, tail), n);
|
|
|
a7c7ac3 |
+ ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n);
|
|
|
a7c7ac3 |
|
|
|
a7c7ac3 |
if (ret)
|
|
|
a7c7ac3 |
return -EFAULT;
|