diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index e447651..b405b9a 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -425,8 +425,11 @@ static int rfcomm_release_dev(void __user *arg) if (dev->tty) tty_vhangup(dev->tty); - rfcomm_dev_del(dev); - rfcomm_dev_put(dev); + if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { + rfcomm_dev_del(dev); + rfcomm_dev_put(dev); + } + return 0; }