public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: prevent potential hlist double deletion
Date: Mon, 22 Jun 2015 18:44:20 +0200	[thread overview]
Message-ID: <55883B64.1050201@meshcoding.com> (raw)
In-Reply-To: <1434904223-10227-2-git-send-email-mareklindner@neomailbox.ch>

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



On 21/06/15 18:30, Marek Lindner wrote:
> The hlist_del_rcu() call in batadv_tt_global_size_mod() does not check
> if the element still is part of the list prior to deletion. The atomic
> list counter should prevent the worst but converting to
> hlist_del_init_rcu() ensures the element can't be deleted more than
> once.
> 
> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>

Acked-by: Antonio Quartulli <antonio@meshcoding.com>

However, as discussed offline after Sven's suggestion in ticket #217,
the entire if-loop still needs to be protected with the vlan_list_lock
and not just its body.

Cheers,

> ---
>  net/batman-adv/translation-table.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
> index ca0bcac..e29c9e1 100644
> --- a/net/batman-adv/translation-table.c
> +++ b/net/batman-adv/translation-table.c
> @@ -315,7 +315,7 @@ static void batadv_tt_global_size_mod(struct batadv_orig_node *orig_node,
>  
>  	if (atomic_add_return(v, &vlan->tt.num_entries) == 0) {
>  		spin_lock_bh(&orig_node->vlan_list_lock);
> -		hlist_del_rcu(&vlan->list);
> +		hlist_del_init_rcu(&vlan->list);
>  		spin_unlock_bh(&orig_node->vlan_list_lock);
>  		batadv_orig_node_vlan_free_ref(vlan);
>  	}
> 

-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-06-22 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21 16:30 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: convert orig_node->vlan_list to hlist Marek Lindner
2015-06-21 16:30 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: prevent potential hlist double deletion Marek Lindner
2015-06-22 16:44   ` Antonio Quartulli [this message]
2015-06-28 14:11     ` Marek Lindner
2015-06-22 16:37 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: convert orig_node->vlan_list to hlist Antonio Quartulli
2015-06-28 14:09   ` 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=55883B64.1050201@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=mareklindner@neomailbox.ch \
    /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