Skip to contentSkip to conversation

rfcomm tty: destroy before tty_close()

PATCH Applied [email protected] 2 participants 2 messages Feb 5, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 7/7 rfcomm tty: destroy before tty_close()

From: Dave Young <[email protected]>

rfcomm dev could be deleted in tty_hangup, so we must not call rfcomm_dev_del again to prevent from destroying rfcomm dev before tty close.

---

 net/bluetooth/rfcomm/tty.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/rfcomm/tty.c renamed from net/bluetooth/rfcomm/tty.c~rfcomm-tty-destroy-before-tty_close +2 -1
diff -puN net/bluetooth/rfcomm/tty.c~rfcomm-tty-destroy-before-tty_close net/bluetooth/rfcomm/tty.c
@@ -429,7 +429,8 @@ static int rfcomm_release_dev(void __use
 	if (dev->tty)
 		tty_vhangup(dev->tty);
 
-	rfcomm_dev_del(dev);
+	if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags))
+		rfcomm_dev_del(dev);
 	rfcomm_dev_put(dev);
 	return 0;
 }

_