From: Tomasz Nowicki <tomasz.nowicki at linaro.org> Signed-off-by: Tomasz Nowicki <tomasz.nowicki at linaro.org> Signed-off-by: Robert Richter <rrichter at cavium.com> Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev at caviumnetworks.com> --- drivers/tty/n_tty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index c9c27f6..b9dcc83 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1701,6 +1701,7 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, { struct n_tty_data *ldata = tty->disc_data; int room, n, rcvd = 0, overflow; + size_t *read_tail_tmp = &ldata->read_tail; down_read(&tty->termios_rwsem); @@ -1718,7 +1719,7 @@ n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, * the consumer has loaded the data in read_buf up to the new * read_tail (so this producer will not overwrite unread data) */ - size_t tail = smp_load_acquire(&ldata->read_tail); + size_t tail = smp_load_acquire(read_tail_tmp); room = N_TTY_BUF_SIZE - (ldata->read_head - tail); if (I_PARMRK(tty)) -- 2.4.3