diff options
-rw-r--r-- | include/net/bluetooth/rfcomm.h | 1 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 6 |
2 files changed, 5 insertions, 2 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, | |||
333 | 333 | ||
334 | /* rfcomm_dev.status bit definitions */ | 334 | /* rfcomm_dev.status bit definitions */ |
335 | #define RFCOMM_DEV_RELEASED 0 | 335 | #define RFCOMM_DEV_RELEASED 0 |
336 | #define RFCOMM_TTY_OWNED 1 | ||
336 | 337 | ||
337 | struct rfcomm_dev_req { | 338 | struct rfcomm_dev_req { |
338 | s16 dev_id; | 339 | s16 dev_id; |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index d9d4bc89e638..bb570d95adca 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -441,7 +441,7 @@ static int rfcomm_release_dev(void __user *arg) | |||
441 | tty_kref_put(tty); | 441 | tty_kref_put(tty); |
442 | } | 442 | } |
443 | 443 | ||
444 | if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) | 444 | if (!test_bit(RFCOMM_TTY_OWNED, &dev->status)) |
445 | tty_port_put(&dev->port); | 445 | tty_port_put(&dev->port); |
446 | 446 | ||
447 | tty_port_put(&dev->port); | 447 | tty_port_put(&dev->port); |
@@ -685,8 +685,10 @@ static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty) | |||
685 | * when the last process closes the tty. The behaviour is expected by | 685 | * when the last process closes the tty. The behaviour is expected by |
686 | * userspace. | 686 | * userspace. |
687 | */ | 687 | */ |
688 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) | 688 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { |
689 | set_bit(RFCOMM_TTY_OWNED, &dev->status); | ||
689 | tty_port_put(&dev->port); | 690 | tty_port_put(&dev->port); |
691 | } | ||
690 | 692 | ||
691 | return 0; | 693 | return 0; |
692 | } | 694 | } |