Re: [Fwd: [PATCH v2 0/4] TTY: port hangup and close fixes]

From: Jiri Slaby
Date: Wed Mar 06 2013 - 11:22:57 EST


On 03/05/2013 11:32 PM, Peter Hurley wrote:
>> So I'm thinking about
>> something like this:
>>
>> if (port->tty)
>> set_bit(TTY_IO_ERROR, &port->tty->flags);
>> tty = port->tty; <=== take a snapshot
>> spin_unlock_irqrestore(&port->lock, flags);
>> tty_port_shutdown(port, tty); <=== use the snapshot
>> set_tty_port(port, NULL); <=== put kref on that tty
>
> Yeah, that's better.

But still not correct. The tty can be invalid (freed) at the time
tty_port_shutdown is called. We should take a real reference inside the
lock and put the reference explicitly after the call.

--
js
suse labs
--
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/