public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Ville Tervo <ville.tervo@nokia.com>
Cc: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] [Patch] Keep rfcomm device in list until it's freed
Date: Mon, 04 Jun 2007 12:44:38 +0200	[thread overview]
Message-ID: <1180953879.13429.25.camel@violet> (raw)
In-Reply-To: <20070604103256.GH6310@null.research.nokia.com>

Hi Ville,

> > > > > Here is patch for rfcomm to keep rfcomm device in list until it's really
> > > > > unused.
> > > > 
> > > >         dev = __rfcomm_dev_get(id);
> > > > +
> > > > +       if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
> > > > +               dev = NULL;
> > > > +
> > > >         if (dev)
> > > >                 rfcomm_dev_hold(dev);
> > > > 
> > > > a test_bit() and then return NULL at the beginning makes more sense. No
> > > > need to take the lock since test_bit() is atomic anyway.
> > > 
> > > How do I get flags then? Function only gets device id.
> > 
> > good point. I overlooked that part.
> > 
> > > I noticed another bug. If __rfcomm_dev_get returns null we end up using
> > > NULL pointer. Fixed version attached.
> > 
> > Please remove this part:
> > 
> > -#ifndef CONFIG_BT_RFCOMM_DEBUG
> > +#ifdef CONFIG_BT_RFCOMM_DEBUG
> 
> Removed.
> 
> > 
> > And use this code:
> > 
> > 	if (dev) {
> > 		if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
> > 			dev = NULL;
> > 		else
> > 	                rfcomm_dev_hold(dev);
> > 	}
> > 
> > It makes it a little bit more readable and easier to understand what we
> > are doing there.
> 
> Agreed. New version attached.

do you have a simple re-producer for it. I need to test this on my Quad
G5 before pushing this upstream.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2007-06-04 10:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-01 11:11 [Patch] Keep rfcomm device in list until it's freed Ville Tervo
2007-06-01 15:21 ` [Bluez-devel] " Marcel Holtmann
2007-06-04  8:35   ` Ville Tervo
2007-06-04  8:49     ` [Bluez-devel] " Marcel Holtmann
2007-06-04  9:47       ` Ulisses Furquim
2007-06-04 10:01         ` Marcel Holtmann
2007-06-04 13:17           ` Ulisses Furquim
2007-06-04 10:32       ` Ville Tervo
2007-06-04 10:44         ` Marcel Holtmann [this message]
2007-06-04 11:55           ` Ville Tervo
2007-06-04 12:24             ` [Bluez-devel] " Marcel Holtmann

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=1180953879.13429.25.camel@violet \
    --to=marcel@holtmann.org \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=ville.tervo@nokia.com \
    /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