From: Dave Young Date: Tue, 5 Feb 2008 11:12:06 +0000 (-0800) Subject: bluetooth rfcomm tty: destroy before tty_close() X-Git-Tag: v2.6.25-rc1~787^2~6 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=93d807401ced2320d0d1e56bf9de099bba5c0424;p=linux-2.6-omap-h63xx.git bluetooth rfcomm tty: destroy before tty_close() 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. Signed-off-by: Dave Young Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 788c7032185..e4c779bb8d7 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -429,7 +429,8 @@ static int rfcomm_release_dev(void __user *arg) 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; }