diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-02-09 20:59:08 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-14 13:39:29 -0800 |
commit | 80ea73378af46b0023eb2f400d26c2a60248ffaa (patch) | |
tree | 3a1c25981ab3a5a77a1d656c7b2b44dae32d2698 /include/net/bluetooth/rfcomm.h | |
parent | 1c64834e0624c61735308138e67cc3b527f41621 (diff) | |
download | linux-80ea73378af46b0023eb2f400d26c2a60248ffaa.tar.gz linux-80ea73378af46b0023eb2f400d26c2a60248ffaa.tar.bz2 linux-80ea73378af46b0023eb2f400d26c2a60248ffaa.zip |
Bluetooth: Fix unreleased rfcomm_dev reference
When RFCOMM_RELEASE_ONHUP is set, the rfcomm tty driver 'takes over'
the initial rfcomm_dev reference created by the RFCOMMCREATEDEV ioctl.
The assumption is that the rfcomm tty driver will release the
rfcomm_dev reference when the tty is freed (in rfcomm_tty_cleanup()).
However, if the tty is never opened, the 'take over' never occurs,
so when RFCOMMRELEASEDEV ioctl is called, the reference is not
released.
Track the state of the reference 'take over' so that the release
is guaranteed by either the RFCOMMRELEASEDEV ioctl or the rfcomm tty
driver.
Note that the synchronous hangup in rfcomm_release_dev() ensures
that rfcomm_tty_install() cannot race with the RFCOMMRELEASEDEV ioctl.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Tested-By: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/bluetooth/rfcomm.h')
-rw-r--r-- | include/net/bluetooth/rfcomm.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index b9759eb17cdd..0d69936831fa 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h @@ -333,6 +333,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, /* rfcomm_dev.status bit definitions */ #define RFCOMM_DEV_RELEASED 0 +#define RFCOMM_TTY_OWNED 1 struct rfcomm_dev_req { s16 dev_id; |