Commit fbd033be authored by Marcelo Tosatti's avatar Marcelo Tosatti Committed by Linus Torvalds

[PATCH] Fix cyclades async driver timeout miscalculation

This fixes a problem where cy_wait_until_sent() miscalculates (calculate
-1 on a unsigned long) the "char_time" parameter passed to
schedule_timeout().

Fix that by making it a signed long, and checking for negative value.
parent 44fbe3d2
......@@ -2679,7 +2679,8 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout)
struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
unsigned char *base_addr;
int card,chip,channel,index;
unsigned long orig_jiffies, char_time;
unsigned long orig_jiffies;
signed long char_time;
if (serial_paranoia_check(info, tty->name, "cy_wait_until_sent"))
return;
......@@ -2699,7 +2700,7 @@ cy_wait_until_sent(struct tty_struct *tty, int timeout)
*/
char_time = (info->timeout - HZ/50) / info->xmit_fifo_size;
char_time = char_time / 5;
if (char_time == 0)
if (char_time <= 0)
char_time = 1;
if (timeout < 0)
timeout = 0;
......
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