Re: [PATCHv5 05/17] tty: don't allow ldisc dcd_change() after ldischalt

From: Alan Cox
Date: Wed Nov 24 2010 - 11:45:47 EST


On Wed, 24 Nov 2010 19:15:43 +0300
Alexander Gordeev <lasaine@xxxxxxxxxxxxx> wrote:

> There was a possibility that uart_handle_dcd_change() could obtain a
> reference to ldisc while running in parallel with tty_set_ldisc() on
> different CPU but call dcd_change() operation after tty_ldisc_close()
> which is incorrect.

How can this occur ?


> + spin_lock_irqsave(&tty->dcd_change_lock, flags);
> +
> + ld = tty_ldisc_ref(tty);

What is the expecting lock ordering rule here ?



I don't see why this patch is needed. You've got an ldisc ref from
tty_ldisc_ref, until you drop that ldisc ref you are fine. If for some
reason that is not the case then there is a bug in the ldisc code.

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