From: Dave Young rfcomm_dev_del could be called twice time in release function. one by rfcomm_tty_hangup, another by rfcomm_release_dev, this will cause the device being destructed before rfcomm_tty_close. Signed-off-by: Dave Young Cc: Alan Cox Cc: Marcel Holtmann Signed-off-by: Andrew Morton --- net/bluetooth/rfcomm/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN net/bluetooth/rfcomm/tty.c~bluetooth-rfcomm-tty_close-before-destruct net/bluetooth/rfcomm/tty.c --- a/net/bluetooth/rfcomm/tty.c~bluetooth-rfcomm-tty_close-before-destruct +++ a/net/bluetooth/rfcomm/tty.c @@ -424,8 +424,8 @@ static int rfcomm_release_dev(void __use /* Shut down TTY synchronously before freeing rfcomm_dev */ if (dev->tty) tty_vhangup(dev->tty); - - rfcomm_dev_del(dev); + else if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) + rfcomm_dev_del(dev); rfcomm_dev_put(dev); return 0; } _