From: Peter Hurley Date: Sat, 15 Jun 2013 11:28:30 +0000 (-0400) Subject: n_tty: Fix unsafe update of available buffer space X-Git-Tag: omap-for-v3.11/fixes-for-merge-window~77^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b84830527645dfe7b7a5cc03518e3c791b4ee9e0;p=pandora-kernel.git n_tty: Fix unsafe update of available buffer space receive_room is used to control the amount of data the flip buffer work can push to the read buffer. This update is unsafe: CPU 0 | CPU 1 | | n_tty_read() | n_tty_set_room() | left = n_tty_receive_buf() | | n_tty_set_room() | left = | tty->receive_room = left | | tty->receive_room = left receive_room is now updated with a stale calculation of the available buffer space, and the subsequent work loop will likely overwrite unread data in the input buffer. Update receive_room atomically with the calculation of the available buffer space. Signed-off-by: Peter Hurley Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed