Skip to content

Commit

Permalink
[Bluetooth] Hangup TTY before releasing rfcomm_dev
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mikko Rapeli authored and Marcel Holtmann committed Jul 11, 2007
1 parent 924f0e4 commit 84950cf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/bluetooth/rfcomm/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 84950cf

Please sign in to comment.