b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH v3 1/2] batman-adv: fix race conditions on interface removal
Date: Sat, 29 Oct 2016 08:55:44 +0200	[thread overview]
Message-ID: <1546440.hnPT5BvDlZ@sven-edge> (raw)
In-Reply-To: <20161029024646.GE7448@otheros>

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

On Samstag, 29. Oktober 2016 04:46:46 CEST Linus Lüssing wrote:
[...]
> > [...]
> > > +bool batadv_forw_packet_steal(struct batadv_forw_packet *forw_packet,
> > > +			      spinlock_t *lock)
> > > +{
> > > +	struct hlist_head head = HLIST_HEAD_INIT;
[...]
> > > +	/* Just to spot misuse of this function */
> > > +	hlist_add_head(&forw_packet->bm_list, &head);
> > > +	hlist_add_fake(&forw_packet->bm_list);
> > 
> > Sorry, I don't get how this should spot misuse via this extra hlist_add_head.
> > You first add the packet to the list (on the stack) and then setting pprev
> > pointer to itself. So you basically have a fake hashed node with next pointer
> > set to NULL. Wouldn't it be better here to use INIT_HLIST_NODE instead of
> > hlist_add_head? I would even say that INIT_HLIST_NODE isn't needed here
> > because you already did this during batadv_forw_packet_alloc.
> > 
> > But I would assume that you actually only wanted hlist_add_fake for the
> > WARN_ONCE in batadv_forw_packet_queue, right?
> 
> Right :). I'm only using the _fake() variant for this WARN_ONCE.
> (So I'll leave that as is? Or too confusing? Do you want me to
> reword / clarify something better in the code?)

I think the _fake stuff + comment is ok. But the add to the hlist_head
on the stack is confusing and maybe should be removed.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2016-10-29  6:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05 23:43 [B.A.T.M.A.N.] [PATCH v3 0/2] batman-adv: hard interface removal fixes Linus Lüssing
2016-10-05 23:43 ` [B.A.T.M.A.N.] [PATCH v3 1/2] batman-adv: fix race conditions on interface removal Linus Lüssing
2016-10-21 12:30   ` Sven Eckelmann
2016-10-29  2:46     ` Linus Lüssing
2016-10-29  6:55       ` Sven Eckelmann [this message]
2016-10-31  7:22         ` Linus Lüssing
2016-10-31  8:09           ` Sven Eckelmann
2016-10-31  9:57             ` Linus Lüssing
2016-10-05 23:43 ` [B.A.T.M.A.N.] [PATCH v3 2/2] batman-adv: fix splat on disabling an interface Linus Lüssing
2016-10-21 12:49   ` Sven Eckelmann

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=1546440.hnPT5BvDlZ@sven-edge \
    --to=sven@narfation.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;
as well as URLs for NNTP newsgroup(s).