Patchwork [REGRESSION] "USB: use kfifo to buffer usb-generic serial writes" causes gobi_loader to hang

login
register
mail settings
Submitter Oliver Neukum
Date Jan. 19, 2010, 1:20 p.m.
Message ID <201001191420.29652.oliver@neukum.org>
Download mbox | patch
Permalink /patch/73878/
State New, archived
Headers show

Comments

Patch

From d7317bae0772b794a1cc9b832bc3d3e1b3642a13 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@neukum.org>
Date: Tue, 19 Jan 2010 14:16:41 +0100
Subject: [PATCH] usb:serial:Deal with filled FIFO

Bail out if the FIFO is filled

Signed-off-by: Oliver Neukum <oliver@neukum.org>
---
 drivers/usb/serial/generic.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 76e5514..053f7f1 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -349,6 +349,10 @@  int usb_serial_generic_write(struct tty_struct *tty,
 
 	count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
 	dbg("%s - put %d bytes into fifo", __func__, count);
+	if (!count) {
+		dbg("%s - FIFO is full", __func__);
+		return 0;
+	}
 	result = usb_serial_generic_write_start(port);
 
 	if (result >= 0)
-- 
1.6.4.2