]> err.no Git - linux-2.6/commitdiff
[Bluetooth] Hangup TTY before releasing rfcomm_dev
authorMikko Rapeli <mikko.rapeli@iki.fi>
Wed, 11 Jul 2007 07:18:15 +0000 (09:18 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 11 Jul 2007 05:01:26 +0000 (07:01 +0200)
The core problem is that RFCOMM socket layer ioctl can release
rfcomm_dev struct while RFCOMM TTY layer is still actively using
it. Calling tty_vhangup() is needed for a synchronous hangup before
rfcomm_dev is freed.

Addresses the oops at http://bugzilla.kernel.org/show_bug.cgi?id=7509

Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/rfcomm/tty.c

index b2b1cceb102a1961c9d1e9c7161228c232281ec7..ba469b038ea0384a306884e4a10e3710137240cc 100644 (file)
@@ -383,6 +383,10 @@ static int rfcomm_release_dev(void __user *arg)
        if (req.flags & (1 << RFCOMM_HANGUP_NOW))
                rfcomm_dlc_close(dev->dlc, 0);
 
+       /* Shut down TTY synchronously before freeing rfcomm_dev */
+       if (dev->tty)
+               tty_vhangup(dev->tty);
+
        rfcomm_dev_del(dev);
        rfcomm_dev_put(dev);
        return 0;