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

Jan Dittmer
2004-12-31T09:46:06Z

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