Linux bluetooth development
 help / color / mirror / Atom feed
From: Ville Tervo <ville.tervo@nokia.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] [PATCH] rfcomm_dev_del is called twice if RFCOMM_HANGUP_NOW flag is used
Date: Thu, 24 Aug 2006 18:09:26 +0300	[thread overview]
Message-ID: <20060824150926.GQ8944@null.research.nokia.com> (raw)

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

Hi Marcel,

I noticed that rfcomm_dev_del() may be called twice if
RFCOMM_HANGUP_NOW flags is used with RFCOMMRELEASEDEV ioctl.

I made a patch that checks if dev is still in the device list before
calling deleting device.

The checking is done now in rfcomm_release_dev. Maybe better place would
be rfcomm_dev_del?

-- 
Ville

[-- Attachment #2: 20060824_rfcomm_tty_dev_double_del_fix.txt --]
[-- Type: text/plain, Size: 544 bytes --]

diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index bd8d671..330760f 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -364,8 +364,13 @@ static int rfcomm_release_dev(void __use
 	if (req.flags & (1 << RFCOMM_HANGUP_NOW))
 		rfcomm_dlc_close(dev->dlc, 0);
 
-	rfcomm_dev_del(dev);
 	rfcomm_dev_put(dev);
+
+	/* dev might be deleted allready by rfcomm_dlc_close.
+	 * Check that device is still on the list. */
+	if ((dev = rfcomm_dev_get(req.dev_id)))
+		rfcomm_dev_del(dev);
+
 	return 0;
 }
 

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

             reply	other threads:[~2006-08-24 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-24 15:09 Ville Tervo [this message]
2006-08-24 18:29 ` [Bluez-devel] [PATCH] rfcomm_dev_del is called twice if RFCOMM_HANGUP_NOW flag is used Ulisses Furquim
2006-08-25  7:42   ` Ville Tervo

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=20060824150926.GQ8944@null.research.nokia.com \
    --to=ville.tervo@nokia.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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