Skip to content

Commit 6b2a3d6

Browse files
peterhurleygregkh
authored andcommitted
tty: audit: Fix audit source
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 <[email protected]> # 4.1+ Cc: Miloslav Trmač <[email protected]> Signed-off-by: Peter Hurley <[email protected]> Acked-by: Laura Abbott <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f356d7a commit 6b2a3d6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

drivers/tty/n_tty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty,
169169
{
170170
struct n_tty_data *ldata = tty->disc_data;
171171

172-
tty_audit_add_data(tty, to, n, ldata->icanon);
172+
tty_audit_add_data(tty, from, n, ldata->icanon);
173173
return copy_to_user(to, from, n);
174174
}
175175

drivers/tty/tty_audit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
265265
*
266266
* Audit @data of @size from @tty, if necessary.
267267
*/
268-
void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
268+
void tty_audit_add_data(struct tty_struct *tty, const void *data,
269269
size_t size, unsigned icanon)
270270
{
271271
struct tty_audit_buf *buf;

include/linux/tty.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,16 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
607607

608608
/* tty_audit.c */
609609
#ifdef CONFIG_AUDIT
610-
extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
610+
extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
611611
size_t size, unsigned icanon);
612612
extern void tty_audit_exit(void);
613613
extern void tty_audit_fork(struct signal_struct *sig);
614614
extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
615615
extern void tty_audit_push(struct tty_struct *tty);
616616
extern int tty_audit_push_current(void);
617617
#else
618-
static inline void tty_audit_add_data(struct tty_struct *tty,
619-
unsigned char *data, size_t size, unsigned icanon)
618+
static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
619+
size_t size, unsigned icanon)
620620
{
621621
}
622622
static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)

0 commit comments

Comments
 (0)