diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-11-06 05:59:47 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-06 07:34:22 +0100 |
commit | 69df9d5993bd7dd7499ad0e98fe824147fbe5667 (patch) | |
tree | 584ed41f2122f46ea2adacfc0442617c88b4c007 /net/ipv4/ip_fragment.c | |
parent | net_cls: Use __dev_get_by_index() (diff) | |
download | linux-69df9d5993bd7dd7499ad0e98fe824147fbe5667.tar.xz linux-69df9d5993bd7dd7499ad0e98fe824147fbe5667.zip |
ip_frag: dont touch device refcount
When sending fragmentation expiration ICMP V4/V6 messages,
we can avoid touching device refcount, thanks to RCU
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r-- | net/ipv4/ip_fragment.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 575f9bd51ccd..b007f8af6e1f 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -206,10 +206,11 @@ static void ip_expire(unsigned long arg) struct sk_buff *head = qp->q.fragments; /* Send an ICMP "Fragment Reassembly Timeout" message. */ - if ((head->dev = dev_get_by_index(net, qp->iif)) != NULL) { + rcu_read_lock(); + head->dev = dev_get_by_index_rcu(net, qp->iif); + if (head->dev) icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0); - dev_put(head->dev); - } + rcu_read_unlock(); } out: spin_unlock(&qp->q.lock); |