Commit 607f4e38 authored by Paul Fulghum's avatar Paul Fulghum Committed by Linus Torvalds

[PATCH] new tty buffering access fix

Fix typos in new tty buffering that incorrectly
access and update buffers in pending queue.
Signed-off-by: default avatarPaul Fulghum <paulkf@microgate.com>
Acked-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4cec8736
...@@ -312,7 +312,7 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) ...@@ -312,7 +312,7 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
int tty_buffer_request_room(struct tty_struct *tty, size_t size) int tty_buffer_request_room(struct tty_struct *tty, size_t size)
{ {
struct tty_buffer *b = tty->buf.head, *n; struct tty_buffer *b = tty->buf.tail, *n;
int left = 0; int left = 0;
/* OPTIMISATION: We could keep a per tty "zero" sized buffer to /* OPTIMISATION: We could keep a per tty "zero" sized buffer to
...@@ -326,7 +326,6 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) ...@@ -326,7 +326,6 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
n = tty_buffer_find(tty, size); n = tty_buffer_find(tty, size);
if(n == NULL) if(n == NULL)
return left; return left;
n->next = b;
if(b != NULL) if(b != NULL)
b->next = n; b->next = n;
else else
...@@ -2751,6 +2750,8 @@ static void flush_to_ldisc(void *private_) ...@@ -2751,6 +2750,8 @@ static void flush_to_ldisc(void *private_)
spin_lock_irqsave(&tty->read_lock, flags); spin_lock_irqsave(&tty->read_lock, flags);
while((tbuf = tty->buf.head) != NULL) { while((tbuf = tty->buf.head) != NULL) {
tty->buf.head = tbuf->next; tty->buf.head = tbuf->next;
if (tty->buf.head == NULL)
tty->buf.tail = NULL;
spin_unlock_irqrestore(&tty->read_lock, flags); spin_unlock_irqrestore(&tty->read_lock, flags);
/* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */
disc->receive_buf(tty, tbuf->char_buf_ptr, disc->receive_buf(tty, tbuf->char_buf_ptr,
...@@ -2759,7 +2760,6 @@ static void flush_to_ldisc(void *private_) ...@@ -2759,7 +2760,6 @@ static void flush_to_ldisc(void *private_)
spin_lock_irqsave(&tty->read_lock, flags); spin_lock_irqsave(&tty->read_lock, flags);
tty_buffer_free(tty, tbuf); tty_buffer_free(tty, tbuf);
} }
tty->buf.tail = NULL;
spin_unlock_irqrestore(&tty->read_lock, flags); spin_unlock_irqrestore(&tty->read_lock, flags);
out: out:
tty_ldisc_deref(disc); tty_ldisc_deref(disc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment