[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111123192233.44f512b7@bob.linux.org.uk>
Date: Wed, 23 Nov 2011 19:22:33 +0000
From: Alan Cox <alan@...ux.intel.com>
To: Havard Skinnemoen <hskinnemoen@...gle.com>
Cc: Jiri Slaby <jslaby@...e.cz>, Dave Jones <davej@...hat.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
Jiri Slaby <jirislaby@...il.com>
Subject: Re: [RFC] cdc-acm: Fix potential deadlock (lockdep warning)
O> This means we need some other way of preventing the device state from
> being freed before we're done cleaning up. Using the existing kref in
> tty_port, we can let the TTY side and the USB side indenpendently
> signal that they're done with the object, and free it when both are
> done.
I would have thought doing a vhangup was the best approach. The way the
USB serial drivers do it on a cable pull is
take lock
mark device disconnected
drop lock
for each tty on the device {
tty_port_tty_get
if (tty) {
tty_vhangup(tty);
tty_kref_put(tty);
}
then do the USB disconnect processing
and drop our USB side kref
and on the open side they provide their own install() method which
nicely avoids all the nasty locking problems and lets them use the
standard tty_port_open/close/hangup etc rather than the partial ones.
It might be worth turning the ACM driver to work the same way as it'll
save doing that work later to achieve the same use of
tty_port_open/close/..
The main thing is the use of install - which lets you plug the USB and
tty bits together during the lookup of the device.
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