]> git.baikalelectronics.ru Git - kernel.git/commit
n_tty: Fix 4096-byte canonical reads
authorPeter Hurley <peter@hurleysoftware.com>
Fri, 22 Nov 2013 12:16:25 +0000 (07:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Nov 2013 16:36:56 +0000 (08:36 -0800)
commitaf74f5d47341b291a29f062066bd438f42461ceb
tree9c7b1fffb698f410a86463fcc700bec3fca8f6fc
parent7e5104153e5fa95f7cf10879c2a58290929c6fc5
n_tty: Fix 4096-byte canonical reads

Although the maximum allowable canonical line is specified to
be 255 bytes (MAX_CANON), the practical limit has actually been
the size of the line discipline read buffer (N_TTY_BUF_SIZE == 4096).

Commit 703533ce92cfc26cfe8ae52bd696c5516847034a,
n_tty: Line copy to user buffer in canonical mode, limited the
line copy to 4095 bytes. With a completely full line discipline
read buffer and a userspace buffer > 4095, _no_ data was copied,
and the read() syscall returned 0, indicating EOF.

Fix the interval arithmetic to compute the correct number of bytes
to copy to userspace in the range [1..4096].

Cc: <stable@vger.kernel.org> # 3.12.x
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c