mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	n_tty: Fix auditing support for cannonical mode
Commit32f13521ca("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:32f13521ca("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>
This commit is contained in:
		
							parent
							
								
									9809889c70
								
							
						
					
					
						commit
						72586c6061
					
				
					 1 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -162,6 +162,17 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
 | 
			
		|||
	return put_user(x, ptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline int tty_copy_to_user(struct tty_struct *tty,
 | 
			
		||||
					void __user *to,
 | 
			
		||||
					const void *from,
 | 
			
		||||
					unsigned long n)
 | 
			
		||||
{
 | 
			
		||||
	struct n_tty_data *ldata = tty->disc_data;
 | 
			
		||||
 | 
			
		||||
	tty_audit_add_data(tty, to, n, ldata->icanon);
 | 
			
		||||
	return copy_to_user(to, from, n);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *	n_tty_kick_worker - start input worker (if required)
 | 
			
		||||
 *	@tty: terminal
 | 
			
		||||
| 
						 | 
				
			
			@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,
 | 
			
		|||
		    __func__, eol, found, n, c, size, more);
 | 
			
		||||
 | 
			
		||||
	if (n > size) {
 | 
			
		||||
		ret = copy_to_user(*b, read_buf_addr(ldata, tail), size);
 | 
			
		||||
		ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size);
 | 
			
		||||
		if (ret)
 | 
			
		||||
			return -EFAULT;
 | 
			
		||||
		ret = copy_to_user(*b + size, ldata->read_buf, n - size);
 | 
			
		||||
		ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size);
 | 
			
		||||
	} else
 | 
			
		||||
		ret = copy_to_user(*b, read_buf_addr(ldata, tail), n);
 | 
			
		||||
		ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n);
 | 
			
		||||
 | 
			
		||||
	if (ret)
 | 
			
		||||
		return -EFAULT;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue