b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Antonio Quartulli <antonio@meshcoding.com>
Subject: [B.A.T.M.A.N.] [PATCH 11/14] batman-adv: protect tt request from double deletion
Date: Tue,  4 Aug 2015 18:35:31 +0200	[thread overview]
Message-ID: <1438706134-3492-12-git-send-email-antonio@meshcoding.com> (raw)
In-Reply-To: <1438706134-3492-1-git-send-email-antonio@meshcoding.com>

From: Marek Lindner <mareklindner@neomailbox.ch>

The list_del() calls were changed to list_del_init() to prevent
an accidental double deletion in batadv_tt_req_node_new().

Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
 net/batman-adv/translation-table.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index cb2a2d1..db06de2 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2213,7 +2213,7 @@ static void batadv_tt_req_list_free(struct batadv_priv *bat_priv)
 	spin_lock_bh(&bat_priv->tt.req_list_lock);
 
 	list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
-		list_del(&node->list);
+		list_del_init(&node->list);
 		kfree(node);
 	}
 
@@ -2249,7 +2249,7 @@ static void batadv_tt_req_purge(struct batadv_priv *bat_priv)
 	list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
 		if (batadv_has_timed_out(node->issued_at,
 					 BATADV_TT_REQUEST_TIMEOUT)) {
-			list_del(&node->list);
+			list_del_init(&node->list);
 			kfree(node);
 		}
 	}
@@ -2531,7 +2531,8 @@ out:
 		batadv_hardif_free_ref(primary_if);
 	if (ret && tt_req_node) {
 		spin_lock_bh(&bat_priv->tt.req_list_lock);
-		list_del(&tt_req_node->list);
+		/* list_del_init() verifies tt_req_node still is in the list */
+		list_del_init(&tt_req_node->list);
 		spin_unlock_bh(&bat_priv->tt.req_list_lock);
 		kfree(tt_req_node);
 	}
@@ -2968,7 +2969,7 @@ static void batadv_handle_tt_response(struct batadv_priv *bat_priv,
 	list_for_each_entry_safe(node, safe, &bat_priv->tt.req_list, list) {
 		if (!batadv_compare_eth(node->addr, resp_src))
 			continue;
-		list_del(&node->list);
+		list_del_init(&node->list);
 		kfree(node);
 	}
 
-- 
2.5.0


  parent reply	other threads:[~2015-08-04 16:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 16:35 [B.A.T.M.A.N.] pull request [net]: batman-adv 20150804 Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 01/14] batman-adv: Replace gw_reselect divisor with simple shift Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 02/14] batman-adv: Avoid u32 overflow during gateway select Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 03/14] batman-adv: avoid DAT to mess up LAN state Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 04/14] batman-adv: Make DAT capability changes atomic Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 05/14] batman-adv: Make NC " Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 06/14] batman-adv: Make TT " Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: Make MCAST " Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 08/14] batman-adv: Fix potential synchronization issues in mcast tvlv handler Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 09/14] batman-adv: fix kernel crash due to missing NULL checks Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 10/14] batman-adv: protect tt_local_entry from concurrent delete events Antonio Quartulli
2015-08-04 16:35 ` Antonio Quartulli [this message]
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 12/14] batman-adv: initialize up/down values when adding a gateway Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 13/14] batman-adv: remove broadcast packets scheduled for purged outgoing if Antonio Quartulli
2015-08-04 16:35 ` [B.A.T.M.A.N.] [PATCH 14/14] batman-adv: Fix potentially broken skb network header access Antonio Quartulli
2015-08-04 19:40 ` [B.A.T.M.A.N.] pull request [net]: batman-adv 20150804 David Miller
2015-08-04 19:50   ` Antonio Quartulli
2015-08-04 20:25     ` Sven Eckelmann
2015-08-04 22:28       ` 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=1438706134-3492-12-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.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).