All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Lindner <mareklindner@neomailbox.ch>
To: b.a.t.m.a.n@lists.open-mesh.org,
	"Linus Lüssing" <linus.luessing@c0d3.blue>
Subject: Re: [B.A.T.M.A.N.] [PATCHv3 maint 5/5] batman-adv: Fix potential synchronization issues in mcast tvlv handler
Date: Tue, 16 Jun 2015 22:38:20 +0800	[thread overview]
Message-ID: <1780825.BpgRJrjhz3@voltaire> (raw)
In-Reply-To: <1987884.ZZQIqrk8nR@voltaire>

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

On Tuesday, June 16, 2015 22:12:00 Marek Lindner wrote:
> On Tuesday, June 16, 2015 15:17:23 Linus Lüssing wrote:
> > +               /* flag checks above + mcast_handler_lock prevents this */
> > +               if (unlikely(!hlist_unhashed(node)))
> > +                       BUG();
> > +
> 
> I don't think this will work because hlist_unhashed() checks for node->pprev
> being NULL or not. hlist_del_rcu() sets node->pprev to LIST_POISON2.
> 
> We could also use BUG_ON() for readability. Something like:
> 
> BUG_ON(node->pprev == LIST_POISON2);
> 
> Though there are not many code sections working with LIST_POISON2 outside
> the list handling code.

Correction: Sven pointed out that we should not depend on LIST_POISON2 as it 
may point to some valid code or something utterly random depending on kernel 
configs.

I had overlooked that you had switched to hlist_del_init_rcu() already which 
makes your check valid. Still, would you consider using BUG_ON() ?

Cheers,
Marek

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

      reply	other threads:[~2015-06-16 14:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 13:17 [B.A.T.M.A.N.] [PATCHv3 maint 0/5] Fixes for parallel OGM processing Linus Lüssing
2015-06-16 13:17 ` [B.A.T.M.A.N.] [PATCHv3 maint 1/5] batman-adv: Make DAT capability changes atomic Linus Lüssing
2015-06-16 13:17 ` [B.A.T.M.A.N.] [PATCHv3 maint 2/5] batman-adv: Make NC " Linus Lüssing
2015-06-16 13:17 ` [B.A.T.M.A.N.] [PATCHv3 maint 3/5] batman-adv: Make TT " Linus Lüssing
2015-06-16 13:17 ` [B.A.T.M.A.N.] [PATCHv3 maint 4/5] batman-adv: Make MCAST " Linus Lüssing
2015-06-16 13:17 ` [B.A.T.M.A.N.] [PATCHv3 maint 5/5] batman-adv: Fix potential synchronization issues in mcast tvlv handler Linus Lüssing
2015-06-16 14:12   ` Marek Lindner
2015-06-16 14:38     ` Marek Lindner [this message]

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=1780825.BpgRJrjhz3@voltaire \
    --to=mareklindner@neomailbox.ch \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=linus.luessing@c0d3.blue \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.