Skip to content

Commit

Permalink
tty: audit: Fix audit source
Browse files Browse the repository at this point in the history
The data to audit/record is in the 'from' buffer (ie., the input
read buffer).

Fixes: 72586c6 ("n_tty: Fix auditing support for cannonical mode")
Cc: stable <stable@vger.kernel.org> # 4.1+
Cc: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Laura Abbott <labbott@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Nov 21, 2015
1 parent f356d7a commit 6b2a3d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty,
{
struct n_tty_data *ldata = tty->disc_data;

tty_audit_add_data(tty, to, n, ldata->icanon);
tty_audit_add_data(tty, from, n, ldata->icanon);
return copy_to_user(to, from, n);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/tty_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
*
* Audit @data of @size from @tty, if necessary.
*/
void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
void tty_audit_add_data(struct tty_struct *tty, const void *data,
size_t size, unsigned icanon)
{
struct tty_audit_buf *buf;
Expand Down
6 changes: 3 additions & 3 deletions include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,16 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);

/* tty_audit.c */
#ifdef CONFIG_AUDIT
extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
size_t size, unsigned icanon);
extern void tty_audit_exit(void);
extern void tty_audit_fork(struct signal_struct *sig);
extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
extern void tty_audit_push(struct tty_struct *tty);
extern int tty_audit_push_current(void);
#else
static inline void tty_audit_add_data(struct tty_struct *tty,
unsigned char *data, size_t size, unsigned icanon)
static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
size_t size, unsigned icanon)
{
}
static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
Expand Down

0 comments on commit 6b2a3d6

Please sign in to comment.