Re: [PATCH 04/12] mxser: Use the new locking rules to fixsetserial properly

From: Dan Carpenter
Date: Fri Nov 20 2009 - 07:17:27 EST


On Wed, Nov 18, 2009 at 02:15:23PM +0000, Alan Cox wrote:
> Propogate the init/shutdown mutex through the setserial logic. Use the proper
> locks for the various bits still using the BKL. Kill the BKL in this driver.
>

> drivers/char/mxser.c | 145 +++++++++++++++++++++++++++-----------------------

> @@ -1951,6 +1959,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout)

> + spin_lock_irqsave(&info->slock, flags);
> while (!((lsr = inb(info->ioaddr + UART_LSR)) & UART_LSR_TEMT)) {
> #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
> printk("lsr = %d (jiff=%lu)...", lsr, jiffies);
> #endif
> + spin_unlock_irqrestore(&info->slock, flags);
> schedule_timeout_interruptible(char_time);
> if (signal_pending(current))
> break;
> if (timeout && time_after(jiffies, orig_jiffies + timeout))
> break;

If we break out of this while loop we get a double unlock.

> + spin_lock_irqsave(&info->slock, flags);
> }
> + spin_unlock_irqrestore(&info->slock, flags);
> set_current_state(TASK_RUNNING);
> - unlock_kernel();

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/