|
@@ -441,7 +441,7 @@ static int rfcomm_release_dev(void __user *arg)
|
|
|
tty_kref_put(tty);
|
|
|
}
|
|
|
|
|
|
- if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags))
|
|
|
+ if (!test_bit(RFCOMM_TTY_OWNED, &dev->status))
|
|
|
tty_port_put(&dev->port);
|
|
|
|
|
|
tty_port_put(&dev->port);
|
|
@@ -685,8 +685,10 @@ static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
|
|
|
* when the last process closes the tty. The behaviour is expected by
|
|
|
* userspace.
|
|
|
*/
|
|
|
- if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags))
|
|
|
+ if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
|
|
|
+ set_bit(RFCOMM_TTY_OWNED, &dev->status);
|
|
|
tty_port_put(&dev->port);
|
|
|
+ }
|
|
|
|
|
|
return 0;
|
|
|
}
|