diff options
author | Patrick McHardy <kaber@trash.net> | 2007-03-29 14:46:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-03-29 14:46:52 -0400 |
commit | c01003c20563d1e75ec9828d21743919d2b43977 (patch) | |
tree | 21cae8933e8a4908d8e8c24244a627bf0c997e77 /net/core/dev.c | |
parent | db8b22550d4b83f0910d27a34d05aa16f7f7159f (diff) |
[IFB]: Fix crash on input device removal
The input_device pointer is not refcounted, which means the device may
disappear while packets are queued, causing a crash when ifb passes packets
with a stale skb->dev pointer to netif_rx().
Fix by storing the interface index instead and do a lookup where neccessary.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Acked-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 5984b55311a1..d44b8f1964fa 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1741,8 +1741,8 @@ static int ing_filter(struct sk_buff *skb) | |||
1741 | if (dev->qdisc_ingress) { | 1741 | if (dev->qdisc_ingress) { |
1742 | __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); | 1742 | __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); |
1743 | if (MAX_RED_LOOP < ttl++) { | 1743 | if (MAX_RED_LOOP < ttl++) { |
1744 | printk(KERN_WARNING "Redir loop detected Dropping packet (%s->%s)\n", | 1744 | printk(KERN_WARNING "Redir loop detected Dropping packet (%d->%d)\n", |
1745 | skb->input_dev->name, skb->dev->name); | 1745 | skb->iif, skb->dev->ifindex); |
1746 | return TC_ACT_SHOT; | 1746 | return TC_ACT_SHOT; |
1747 | } | 1747 | } |
1748 | 1748 | ||
@@ -1775,8 +1775,8 @@ int netif_receive_skb(struct sk_buff *skb) | |||
1775 | if (!skb->tstamp.off_sec) | 1775 | if (!skb->tstamp.off_sec) |
1776 | net_timestamp(skb); | 1776 | net_timestamp(skb); |
1777 | 1777 | ||
1778 | if (!skb->input_dev) | 1778 | if (!skb->iif) |
1779 | skb->input_dev = skb->dev; | 1779 | skb->iif = skb->dev->ifindex; |
1780 | 1780 | ||
1781 | orig_dev = skb_bond(skb); | 1781 | orig_dev = skb_bond(skb); |
1782 | 1782 | ||