linux-hardened/net/bluetooth
Marcel Holtmann 9a5df92374 Bluetooth: Fix RFCOMM release oops when device is still in use
It turns out that the following sequence of actions will reproduce the
oops:

  1. Create a new RFCOMM device (using RFCOMMCREATEDEV ioctl)
  2. (Try to) open the device
  3. Release the RFCOMM device (using RFCOMMRELEASEDEV ioctl)

At this point, the "/dev/rfcomm*" device is still in use, but it is gone
from the internal list, so the device id can be reused.

  4. Create a new RFCOMM device with the same device id as before

And now kobject will complain that the TTY already exists.

(See http://lkml.org/lkml/2008/7/13/89 for a reproducible test-case.)

This patch attempts to correct this by only removing the device from the
internal list of devices at the final unregister stage, so that the id
won't get reused until the device has been completely destructed.

This should be safe as the RFCOMM_TTY_RELEASED bit will be set for the
device and prevent the device from being reopened after it has been
released.

Based on a report from Vegard Nossum <vegard.nossum@gmail.com>

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2008-11-30 12:17:29 +01:00
..
bnep Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
cmtp Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
hidp Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
rfcomm Bluetooth: Fix RFCOMM release oops when device is still in use 2008-11-30 12:17:29 +01:00
af_bluetooth.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
hci_conn.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
hci_core.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
hci_event.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
hci_sock.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
hci_sysfs.c Bluetooth: Fix format arguments warning 2008-11-30 12:17:29 +01:00
Kconfig [S390] Kconfig: unwanted menus for s390. 2007-05-10 15:46:07 +02:00
l2cap.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
lib.c [NET] BLUETOOTH: Fix whitespace errors. 2007-02-10 23:19:20 -08:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sco.c Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00