summaryrefslogtreecommitdiff
path: root/include/net/bluetooth/rfcomm.h
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-02-10 05:59:07 +0400
committerMarcel Holtmann <marcel@holtmann.org>2014-02-15 01:39:29 +0400
commit1c64834e0624c61735308138e67cc3b527f41621 (patch)
tree912156866fbaa316a2197f261646737f95a88e57 /include/net/bluetooth/rfcomm.h
parent960603a54aa0d5f4f1c4f1037bcaee571d03cb1e (diff)
downloadlinux-1c64834e0624c61735308138e67cc3b527f41621.tar.xz
Bluetooth: Release rfcomm_dev only once
No logic prevents an rfcomm_dev from being released multiple times. For example, if the rfcomm_dev ref count is large due to pending tx, then multiple RFCOMMRELEASEDEV ioctls may mistakenly release the rfcomm_dev too many times. Note that concurrent ioctls are not required to create this condition. Introduce RFCOMM_DEV_RELEASED status bit which guarantees the rfcomm_dev can only be released once. NB: Since the flags are exported to userspace, introduce the status field to track state for which userspace should not be aware. 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.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index c312cfc4e922..b9759eb17cdd 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -324,11 +324,15 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel,
#define RFCOMMGETDEVINFO _IOR('R', 211, int)
#define RFCOMMSTEALDLC _IOW('R', 220, int)
+/* rfcomm_dev.flags bit definitions */
#define RFCOMM_REUSE_DLC 0
#define RFCOMM_RELEASE_ONHUP 1
#define RFCOMM_HANGUP_NOW 2
#define RFCOMM_TTY_ATTACHED 3
-#define RFCOMM_TTY_RELEASED 4
+#define RFCOMM_DEFUNCT_BIT4 4 /* don't reuse this bit - userspace visible */
+
+/* rfcomm_dev.status bit definitions */
+#define RFCOMM_DEV_RELEASED 0
struct rfcomm_dev_req {
s16 dev_id;