From patchwork Fri Sep 17 15:41:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 351 Return-Path: Received: from mail.gmx.net (mailout-de.gmx.net [213.165.64.22]) by open-mesh.org (Postfix) with SMTP id 0FDBD1544AA for ; Fri, 17 Sep 2010 17:40:26 +0200 (CEST) Received: (qmail invoked by alias); 17 Sep 2010 15:40:25 -0000 Received: from i59F6B7DD.versanet.de (EHLO sven-desktop.lazhur.ath.cx) [89.246.183.221] by mail.gmx.net (mp010) with SMTP; 17 Sep 2010 17:40:25 +0200 X-Authenticated: #15668376 X-Provags-ID: V01U2FsdGVkX1/a8pdqnC/a9koTE3u2spAIolc8BS+Ht0v3Fhw0Vq Woryf52AbPlgUh From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 17 Sep 2010 17:41:00 +0200 Message-Id: <1284738065-8715-5-git-send-email-sven.eckelmann@gmx.de> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1284738065-8715-1-git-send-email-sven.eckelmann@gmx.de> References: <1284738065-8715-1-git-send-email-sven.eckelmann@gmx.de> X-Y-GMX-Trusted: 0 Subject: [B.A.T.M.A.N.] [PATCH 4/9] batman-adv: Remove unneeded rcu_read_lock X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2010 15:40:26 -0000 Regions which do not use rcu functions don't need to protected by rcu_read_lock. If we want to protect data from being freed than it must be covered by the same read-side critical section or otherwise the grace period may already ended and freed the memory before we called rcu_read_lock again. Signed-off-by: Sven Eckelmann --- batman-adv/gateway_client.c | 4 ---- batman-adv/originator.c | 2 -- 2 files changed, 0 insertions(+), 6 deletions(-) diff --git a/batman-adv/gateway_client.c b/batman-adv/gateway_client.c index dd96d99..bfac0ff 100644 --- a/batman-adv/gateway_client.c +++ b/batman-adv/gateway_client.c @@ -342,9 +342,7 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset) struct hlist_node *node; int gw_count = 0; - rcu_read_lock(); if (!bat_priv->primary_if) { - rcu_read_unlock(); return seq_printf(seq, "BATMAN mesh %s disabled - please " "specify interfaces to enable it\n", @@ -352,7 +350,6 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset) } if (bat_priv->primary_if->if_status != IF_ACTIVE) { - rcu_read_unlock(); return seq_printf(seq, "BATMAN mesh %s disabled - " "primary interface not active\n", @@ -365,7 +362,6 @@ int gw_client_seq_print_text(struct seq_file *seq, void *offset) "outgoingIF", SOURCE_VERSION, REVISION_VERSION_STR, bat_priv->primary_if->net_dev->name, bat_priv->primary_if->addr_str, net_dev->name); - rcu_read_unlock(); rcu_read_lock(); hlist_for_each_entry_rcu(gw_node, node, &bat_priv->gw_list, list) { diff --git a/batman-adv/originator.c b/batman-adv/originator.c index 2250266..3424ac2 100644 --- a/batman-adv/originator.c +++ b/batman-adv/originator.c @@ -335,7 +335,6 @@ int orig_seq_print_text(struct seq_file *seq, void *offset) net_dev->name); } - rcu_read_lock(); seq_printf(seq, "[B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)]\n", SOURCE_VERSION, REVISION_VERSION_STR, bat_priv->primary_if->net_dev->name, @@ -343,7 +342,6 @@ int orig_seq_print_text(struct seq_file *seq, void *offset) seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n", "Originator", "last-seen", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF", "Potential nexthops"); - rcu_read_unlock(); spin_lock_irqsave(&bat_priv->orig_hash_lock, flags);