Skip to content

Commit

Permalink
n_tty: Fix calculation of size in canon_copy_from_read_buf
Browse files Browse the repository at this point in the history
There was a hardcoded value of 4096 which should have been N_TTY_BUF_SIZE.
This caused reads from tty to fail with EFAULT when they shouldn't have
done if N_TTY_BUF_SIZE was declared to be something other than 4096.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Mark Tomlinson authored and Greg Kroah-Hartman committed May 24, 2015
1 parent 392bcee commit da555db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -2070,8 +2070,8 @@ static int canon_copy_from_read_buf(struct tty_struct *tty,

size = N_TTY_BUF_SIZE - tail;
n = eol - tail;
if (n > 4096)
n += 4096;
if (n > N_TTY_BUF_SIZE)
n += N_TTY_BUF_SIZE;
n += found;
c = n;

Expand Down

0 comments on commit da555db

Please sign in to comment.