ipv6: no more dev_put() in datagram_send_ctl()
Subsystems (2)
PATCH 1/1 ipv6: no more dev_put() in datagram_send_ctl()
Avoids touching device refcount in datagram_send_ctl(), thanks to RCU
Signed-off-by Eric Dumazet <[email protected]>
--- net/ipv6/datagram.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
net/ipv6/datagram.c +9 -5
@@ -537,12 +537,17 @@ int datagram_send_ctl(struct net *net, addr_type =__ipv6_addr_type (&src_info->ipi6_addr); +rcu_read_lock ();if (fl->oif) { - dev =dev_get_by_index (net, fl->oif); -if (!dev) + dev =dev_get_by_index_rcu (net, fl->oif); +if (!dev) { +rcu_read_unlock ();return -ENODEV ; - }else if (addr_type &IPV6_ADDR_LINKLOCAL ) + } + }else if (addr_type &IPV6_ADDR_LINKLOCAL ) { +rcu_read_unlock ();return -EINVAL ; + }if (addr_type !=IPV6_ADDR_ANY ) {int strict =__ipv6_addr_src_scope (addr_type) <=IPV6_ADDR_SCOPE_LINKLOCAL ;
@@ -553,8 +558,7 @@ int datagram_send_ctl(struct net *net,ipv6_addr_copy (&fl->fl6_src, &src_info->ipi6_addr); } -if (dev) -dev_put (dev); +rcu_read_unlock ();if (err) goto exit_f;
From: Eric Dumazet <[email protected]>
Date: Mon, 02 Nov 2009 12:21:06 +0100
Quoted 3 lines
Avoids touching device refcount in
datagram_send_ctl(), thanks to RCUSigned-off-by Eric Dumazet <[email protected]>
Applied.
Quoted 1 line · Eric Dumazet
Avoids touching device refcount in
datagram_send_ctl(), thanks to RCU
Quite a series of patches!!! I am impressed!!!
Thanx, Paul
Quoted 44 lines
Signed-off-by Eric Dumazet <[email protected]>--- net/ipv6/datagram.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)net/ipv6/datagram.c +9
-6@@ -537,12 +537,17 @@ int datagram_send_ctl(struct net *net, addr_type =__ipv6_addr_type (&src_info->ipi6_addr); +rcu_read_lock ();if (fl->oif) { - dev =dev_get_by_index (net, fl->oif); -if (!dev) + dev =dev_get_by_index_rcu (net, fl->oif); +if (!dev) { +rcu_read_unlock ();return -ENODEV ; - }else if (addr_type &IPV6_ADDR_LINKLOCAL ) + } + }else if (addr_type &IPV6_ADDR_LINKLOCAL ) { +rcu_read_unlock ();return -EINVAL ; + }if (addr_type !=IPV6_ADDR_ANY ) {int strict =__ipv6_addr_src_scope (addr_type) <=IPV6_ADDR_SCOPE_LINKLOCAL ;@@ -553,8 +558,7 @@ int datagram_send_ctl(struct net *net,ipv6_addr_copy (&fl->fl6_src, &src_info->ipi6_addr); } -if (dev) -dev_put (dev); +rcu_read_unlock ();if (err) goto exit_f; --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html