Re: [PATCH] esp: Make driver SMP-correct

From: Jan Dittmer
Date: Fri Dec 31 2004 - 04:47:37 EST


James Nelson wrote:
> static inline int serial_paranoia_check(struct esp_struct *info,
> char *name, const char *routine)
> {
> @@ -209,34 +197,38 @@
> struct esp_struct *info = (struct esp_struct *)tty->driver_data;
> unsigned long flags;
>
> - if (serial_paranoia_check(info, tty->name, "rs_stop"))
> - return;
> + spin_lock_irqsave(&info->irq_lock, flags);
> +
> + if (unlikely(serial_paranoia_check(info, tty->name, __FUNCTION__)))
> + goto out;

> static void rs_start(struct tty_struct *tty)
> {
> struct esp_struct *info = (struct esp_struct *)tty->driver_data;
> unsigned long flags;
> -
> - if (serial_paranoia_check(info, tty->name, "rs_start"))
> - return;
> -
> - save_flags(flags); cli();
> +
> + spin_lock_irqsave(&info->irq_lock, flags);
> +
> + if (unlikely(serial_paranoia_check(info, tty->name, __FUNCTION__)))
> + goto out;
> +

This will deadlock. serial_paranoia_check also unconditionally tries to
take the lock.

Jan
-
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/