public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2 1/7] batman-adv: tvlv - basic infrastructure
Date: Wed, 10 Jun 2015 10:57:14 +0200	[thread overview]
Message-ID: <1519360.DWtKWxiBrp@bentobox> (raw)
In-Reply-To: <1366724403-29629-2-git-send-email-lindner_marek@yahoo.de>

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

On Tuesday 23 April 2013 21:39:57 Marek Lindner wrote:
> +/**
> + * batadv_tvlv_handler_unregister - unregister tvlv handler based on the
> + *  provided type and version (both need to match)
> + * @bat_priv: the bat priv with all the soft interface information
> + * @type: tvlv handler type to be unregistered
> + * @version: tvlv handler version to be unregistered
> + */
> +void batadv_tvlv_handler_unregister(struct batadv_priv *bat_priv,
> +				    uint8_t type, uint8_t version)
> +{
> +	struct batadv_tvlv_handler *tvlv_handler;
> +
> +	tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
> +	if (!tvlv_handler)
> +		return;
> +
> +	batadv_tvlv_handler_free_ref(tvlv_handler);
> +	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
> +	hlist_del_rcu(&tvlv_handler->list);
> +	spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
> +	batadv_tvlv_handler_free_ref(tvlv_handler);
> +}

Looks unsafe. How do you make sure that it is still in the list and not 
already already removed in the meantime? hlist_del_rcu does not re-initialize 
the pointers (only POISON them when CONFIG_DEBUG_LIST is activated). Thus 
calling hlist_del_rcu again on an object not in the list either kills other 
data structures or causes an Oops.

There are more *list_del* related problems of that type in your code. This is 
just one example I've picked.

See http://www.open-mesh.org/issues/217#note-5

Kind regards,
        Sven

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

  parent reply	other threads:[~2015-06-10  8:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 13:39 [B.A.T.M.A.N.] TVLV infrastructure (v2) Marek Lindner
2013-04-23 13:39 ` [B.A.T.M.A.N.] [PATCHv2 1/7] batman-adv: tvlv - basic infrastructure Marek Lindner
2013-04-24 14:22   ` Marek Lindner
2015-06-10  8:57   ` Sven Eckelmann [this message]
2013-04-23 13:39 ` [B.A.T.M.A.N.] [PATCHv2 2/7] batman-adv: tvlv - gateway download/upload bandwidth container Marek Lindner
2013-04-24 14:25   ` Marek Lindner
2013-04-23 13:39 ` [B.A.T.M.A.N.] [PATCHv2 3/7] batman-adv: tvlv - add distributed arp table container Marek Lindner
2013-04-24 14:26   ` Marek Lindner
2013-04-23 13:40 ` [B.A.T.M.A.N.] [PATCHv2 4/7] batman-adv: tvlv - add network coding container Marek Lindner
2013-04-24 14:28   ` Marek Lindner
2013-04-23 13:40 ` [B.A.T.M.A.N.] [PATCHv2 5/7] batman-adv: tvlv - convert tt data sent within OGMs Marek Lindner
2013-04-24 14:29   ` Marek Lindner
2013-04-23 13:40 ` [B.A.T.M.A.N.] [PATCHv2 6/7] batman-adv: tvlv - convert tt query packet to use tvlv unicast packets Marek Lindner
2013-04-24 14:30   ` Marek Lindner
2013-04-23 13:40 ` [B.A.T.M.A.N.] [PATCHv2 7/7] batman-adv: tvlv - convert roaming adv " Marek Lindner
2013-04-24 14:32   ` Marek Lindner

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=1519360.DWtKWxiBrp@bentobox \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=lindner_marek@yahoo.de \
    /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