summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/tty/queue.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2020-01-17 11:20:29 -0800
committergVisor bot <gvisor-bot@google.com>2020-01-17 11:22:10 -0800
commit80d0f9304484897e4307c9701ddbfaacb925715d (patch)
treeb9f80fe992b37209c5bc07367a64e1fa92a259bb /pkg/sentry/fs/tty/queue.go
parent8e8d0f96f651ce161dfe6003d738dbda28f7cb0e (diff)
Fix data race in tty.queue.readableSize.
We were setting queue.readable without holding the lock. PiperOrigin-RevId: 290306922
Diffstat (limited to 'pkg/sentry/fs/tty/queue.go')
-rw-r--r--pkg/sentry/fs/tty/queue.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/pkg/sentry/fs/tty/queue.go b/pkg/sentry/fs/tty/queue.go
index 8b5d4699a..21ccc6f32 100644
--- a/pkg/sentry/fs/tty/queue.go
+++ b/pkg/sentry/fs/tty/queue.go
@@ -197,18 +197,11 @@ func (q *queue) writeBytes(b []byte, l *lineDiscipline) {
q.pushWaitBufLocked(l)
}
-// pushWaitBuf fills the queue's read buffer with data from the wait buffer.
+// pushWaitBufLocked fills the queue's read buffer with data from the wait
+// buffer.
//
// Preconditions:
// * l.termiosMu must be held for reading.
-func (q *queue) pushWaitBuf(l *lineDiscipline) int {
- q.mu.Lock()
- defer q.mu.Unlock()
- return q.pushWaitBufLocked(l)
-}
-
-// Preconditions:
-// * l.termiosMu must be held for reading.
// * q.mu must be locked.
func (q *queue) pushWaitBufLocked(l *lineDiscipline) int {
if q.waitBufLen == 0 {