public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: linux-kernel@vger.kernel.org, bluez-devel@lists.sourceforge.net
Subject: Re: [PATCH]bluetooth rfcomm_dev refcount bug fix
Date: Mon, 05 Nov 2007 16:01:10 +0100	[thread overview]
Message-ID: <1194274870.4437.8.camel@aeonflux> (raw)
In-Reply-To: <20071105045921.GA3556@darkstar.te-china.tietoenator.com>

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

Hi Dave,

> In the rfcomm_tty_hangup the rfcomm_dev refcnt should be dropped later.
> 
> If rfcomm_dev is destructed in tty_hangup function, then the later tty_close function will oops.

your patch removes the complete release on hangup logic. That can't be
right. I think the problem is with calling tty_vhangup() and then
decrementing the reference count. In case we call tty_vhangup and we
have release on hangup we should not delete the device here. What about
the attached patch? Does it solve it?

What are the steps to reproduce this?

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 449 bytes --]

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;
 }
 

  reply	other threads:[~2007-11-05 15:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05  4:59 [PATCH]bluetooth rfcomm_dev refcount bug fix Dave Young
2007-11-05 15:01 ` Marcel Holtmann [this message]
2007-11-06  1:23   ` Dave Young
2007-11-06  3:12   ` Dave Young
2007-11-19  3:00 ` [PATCH][another try]bluetooth rfcomm tty_close before destruct Dave Young
2007-11-19  4:57   ` Dave Young
  -- strict thread matches above, loose matches on Subject: below --
2007-11-06  6:00 [PATCH]bluetooth rfcomm_dev refcount bug fix Dave Young
2007-11-06 13:33 ` Marcel Holtmann
2007-11-07  1:20   ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1194274870.4437.8.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox