[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081104173726.0271939d@lxorguk.ukuu.org.uk>
Date: Tue, 4 Nov 2008 17:37:26 +0000
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: Greg KH <greg@...ah.com>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: Fix close races in USB serial
> > - if (port->port.count == (port->console? 1 : 0)) {
> > + if (port->port.count == (port->console ? 2 : 1)) {
>
> Why are you testing for 2 here?
At the point we enter this routine port->port.count is the number of
users of the port. If this is the final close then this is 1 (us), except
if it is the USB console (in which case there will be two references).
The old code dropped the reference count first, the new code drops the
kref and port->tty first, then shuts down the port and then drops the
refcount. That avoids the race where we get the usb serial drivers trying
to stuff bytes into a closed port and the ldisc layer in turn trying to
echo them
- which causes the warnings.
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists