public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2 3/4] batman-adv: let tt_global_entry_has_orig() return the orig_entry or NULL instead of 1 or 0 only
Date: Tue, 10 Apr 2012 20:17:03 +0200	[thread overview]
Message-ID: <20120410181702.GB23540@ritirata.org> (raw)
In-Reply-To: <4F83146E.2080609@hundeboll.net>

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

Hi Martin,

On Mon, Apr 09, 2012 at 06:55:10PM +0200, Martin Hundebøll wrote:
> Hi Antonio,
> 
> On 04/04/2012 02:42 PM, Antonio Quartulli wrote:
> 
> >   	rcu_read_lock();
> >   	head =&entry->orig_list;
> >   	hlist_for_each_entry_rcu(tmp_orig_entry, node, head, list) {
> >   		if (tmp_orig_entry->orig_node == orig_node) {
> > -			found = true;
> > +			orig_entry = tmp_orig_entry;
> >   			break;
> >   		}
> >   	}
> >   	rcu_read_unlock();
> > -	return found;
> > +	return orig_entry;
> >   }
> 
> I'm not that well into the tt code, but shouldn't there be some reference counting when handing pointers round like this?
> 

mh..I'd agree with you. The entry could be freed somewhere else causing
something we would never imagine ;P

Actually the tt_orig_list_entry doesn't have any mechanism like that and so I
forgot about taking care of this issue.

Thank you very much!

Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2012-04-10 18:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04 12:42 [B.A.T.M.A.N.] [PATCH 0/4] batman-adv: tt code fixes and temporary client detection Antonio Quartulli
2012-04-04 12:42 ` [B.A.T.M.A.N.] [PATCHv2 1/4] batman-adv: clear ADD+DEL (and viceversa) events in the same orig-interval Antonio Quartulli
2012-04-04 12:42 ` [B.A.T.M.A.N.] [PATCHv2 2/4] batman-adv: beautify tt_global_add() argument list Antonio Quartulli
2012-04-04 12:42 ` [B.A.T.M.A.N.] [PATCHv2 3/4] batman-adv: let tt_global_entry_has_orig() return the orig_entry or NULL instead of 1 or 0 only Antonio Quartulli
2012-04-09 16:55   ` Martin Hundebøll
2012-04-10 18:17     ` Antonio Quartulli [this message]
2012-04-04 12:42 ` [B.A.T.M.A.N.] [PATCHv2 4/4] batman-adv: enable nodes to detect not yet announced clients Antonio Quartulli
2012-04-06 10:13   ` Antonio Quartulli

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=20120410181702.GB23540@ritirata.org \
    --to=ordex@autistici.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.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