From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] ifb: should not use __dev_get_by_index() without locks
Date: Tue, 20 Oct 2009 14:35:50 +0200 [thread overview]
Message-ID: <4ADDAEA6.2040903@gmail.com> (raw)
In-Reply-To: <20091019.212855.179405364.davem@davemloft.net>
David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Tue, 20 Oct 2009 06:23:54 +0200
>
>> I wonder if the whole thing could use RCU somehow, since some
>> workloads hit this dev_base_lock rwlock pretty hard...
>
> True, but for now we'll put your fix in :-)
Here is another vulnerable point, needing following patch.
Thanks
[PATCH] ifb: should not use __dev_get_by_index() without locks
At this point (ri_tasklet()), RTNL or dev_base_lock are not held,
we must use dev_get_by_index() instead of __dev_get_by_index()
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 801f088..030913f 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -98,12 +98,13 @@ static void ri_tasklet(unsigned long dev)
stats->tx_packets++;
stats->tx_bytes +=skb->len;
- skb->dev = __dev_get_by_index(&init_net, skb->iif);
+ skb->dev = dev_get_by_index(&init_net, skb->iif);
if (!skb->dev) {
dev_kfree_skb(skb);
stats->tx_dropped++;
break;
}
+ dev_put(skb->dev);
skb->iif = _dev->ifindex;
if (from & AT_EGRESS) {
next prev parent reply other threads:[~2009-10-20 12:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-19 16:41 [PATCH] net: Fix IP_MULTICAST_IF Eric Dumazet
2009-10-20 3:59 ` David Miller
2009-10-20 4:07 ` Eric Dumazet
2009-10-20 4:16 ` Eric Dumazet
2009-10-20 4:21 ` David Miller
2009-10-20 4:20 ` David Miller
2009-10-20 4:23 ` Eric Dumazet
2009-10-20 4:28 ` David Miller
2009-10-20 5:03 ` [PATCH net-next-2.6] net: Introduce dev_get_by_index_rcu() Eric Dumazet
2009-10-20 5:06 ` Stephen Hemminger
2009-10-20 5:18 ` Eric Dumazet
2009-10-29 8:43 ` David Miller
2009-10-20 12:35 ` Eric Dumazet [this message]
2009-10-23 4:54 ` [PATCH] ifb: should not use __dev_get_by_index() without locks David Miller
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=4ADDAEA6.2040903@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.