aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r--net/bluetooth/rfcomm/tty.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 9a7a44fc721f..b2b1cceb102a 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -517,9 +517,10 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
517 if (dlc->state == BT_CLOSED) { 517 if (dlc->state == BT_CLOSED) {
518 if (!dev->tty) { 518 if (!dev->tty) {
519 if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { 519 if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
520 rfcomm_dev_hold(dev); 520 if (rfcomm_dev_get(dev->id) == NULL)
521 rfcomm_dev_del(dev); 521 return;
522 522
523 rfcomm_dev_del(dev);
523 /* We have to drop DLC lock here, otherwise 524 /* We have to drop DLC lock here, otherwise
524 rfcomm_dev_put() will dead lock if it's 525 rfcomm_dev_put() will dead lock if it's
525 the last reference. */ 526 the last reference. */
@@ -974,8 +975,12 @@ static void rfcomm_tty_hangup(struct tty_struct *tty)
974 975
975 rfcomm_tty_flush_buffer(tty); 976 rfcomm_tty_flush_buffer(tty);
976 977
977 if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) 978 if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
979 if (rfcomm_dev_get(dev->id) == NULL)
980 return;
978 rfcomm_dev_del(dev); 981 rfcomm_dev_del(dev);
982 rfcomm_dev_put(dev);
983 }
979} 984}
980 985
981static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused) 986static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused)