diff mbox

[net-next] ipv4: remove nested rcu_read_lock/unlock

Message ID 53DB2D04.6030909@cn.fujitsu.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Duan Jiong Aug. 1, 2014, 6 a.m. UTC
ip_local_deliver_finish() already have a rcu_read_lock/unlock, so
the rcu_read_lock/unlock is unnecessary.

See the stack below:
ip_local_deliver_finish
	|
	|
	->icmp_rcv
		|
		|
		->icmp_socket_deliver

Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv4/icmp.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Hannes Frederic Sowa Aug. 1, 2014, 7:12 p.m. UTC | #1
On Fr, 2014-08-01 at 14:00 +0800, Duan Jiong wrote:
> ip_local_deliver_finish() already have a rcu_read_lock/unlock, so
> the rcu_read_lock/unlock is unnecessary.
> 
> See the stack below:
> ip_local_deliver_finish
> 	|
> 	|
> 	->icmp_rcv
> 		|
> 		|
> 		->icmp_socket_deliver
> 
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>

Cool, thanks!

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Aug. 2, 2014, 10:27 p.m. UTC | #2
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Fri, 1 Aug 2014 14:00:36 +0800

> 
> ip_local_deliver_finish() already have a rcu_read_lock/unlock, so
> the rcu_read_lock/unlock is unnecessary.
> 
> See the stack below:
> ip_local_deliver_finish
> 	|
> 	|
> 	->icmp_rcv
> 		|
> 		|
> 		->icmp_socket_deliver
> 
> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>

Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 092400e..ea7d4af 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -670,11 +670,9 @@  static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
 
 	raw_icmp_error(skb, protocol, info);
 
-	rcu_read_lock();
 	ipprot = rcu_dereference(inet_protos[protocol]);
 	if (ipprot && ipprot->err_handler)
 		ipprot->err_handler(skb, info);
-	rcu_read_unlock();
 }
 
 static bool icmp_tag_validation(int proto)