diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-03-01 03:11:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-01 03:11:52 -0500 |
commit | 4ead443163b798661c2a2ede5e512e116a9e41e7 (patch) | |
tree | 7fb2f0cf1446315805c9ddc3362b124c374c8695 /net | |
parent | 18963caaf55240d6a0491bdb27b7fef2882ffb15 (diff) |
netpoll: Add drop checks to all entry points
The netpoll entry checks are required to ensure that we don't
receive normal packets when invoked via netpoll. Unfortunately
it only ever worked for the netif_receive_skb/netif_rx entry
points. The VLAN (and subsequently GRO) entry point didn't
have the check and therefore can trigger all sorts of weird
problems.
This patch adds the netpoll check to all entry points.
I'm still uneasy with receiving at all under netpoll (which
apparently is only used by the out-of-tree kdump code). The
reason is it is perfectly legal to receive all data including
headers into highmem if netpoll is off, but if you try to do
that with netpoll on and someone gets a printk in an IRQ handler
you're going to get a nice BUG_ON.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/8021q/vlan_core.c | 10 | ||||
-rw-r--r-- | net/core/dev.c | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index e9db889d6222..2886d2fb9ab5 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -1,12 +1,16 @@ | |||
1 | #include <linux/skbuff.h> | 1 | #include <linux/skbuff.h> |
2 | #include <linux/netdevice.h> | 2 | #include <linux/netdevice.h> |
3 | #include <linux/if_vlan.h> | 3 | #include <linux/if_vlan.h> |
4 | #include <linux/netpoll.h> | ||
4 | #include "vlan.h" | 5 | #include "vlan.h" |
5 | 6 | ||
6 | /* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ | 7 | /* VLAN rx hw acceleration helper. This acts like netif_{rx,receive_skb}(). */ |
7 | int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | 8 | int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
8 | u16 vlan_tci, int polling) | 9 | u16 vlan_tci, int polling) |
9 | { | 10 | { |
11 | if (netpoll_rx(skb)) | ||
12 | return NET_RX_DROP; | ||
13 | |||
10 | if (skb_bond_should_drop(skb)) | 14 | if (skb_bond_should_drop(skb)) |
11 | goto drop; | 15 | goto drop; |
12 | 16 | ||
@@ -100,6 +104,9 @@ int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | |||
100 | { | 104 | { |
101 | int err = NET_RX_SUCCESS; | 105 | int err = NET_RX_SUCCESS; |
102 | 106 | ||
107 | if (netpoll_receive_skb(skb)) | ||
108 | return NET_RX_DROP; | ||
109 | |||
103 | switch (vlan_gro_common(napi, grp, vlan_tci, skb)) { | 110 | switch (vlan_gro_common(napi, grp, vlan_tci, skb)) { |
104 | case -1: | 111 | case -1: |
105 | return netif_receive_skb(skb); | 112 | return netif_receive_skb(skb); |
@@ -126,6 +133,9 @@ int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | |||
126 | if (!skb) | 133 | if (!skb) |
127 | goto out; | 134 | goto out; |
128 | 135 | ||
136 | if (netpoll_receive_skb(skb)) | ||
137 | goto out; | ||
138 | |||
129 | err = NET_RX_SUCCESS; | 139 | err = NET_RX_SUCCESS; |
130 | 140 | ||
131 | switch (vlan_gro_common(napi, grp, vlan_tci, skb)) { | 141 | switch (vlan_gro_common(napi, grp, vlan_tci, skb)) { |
diff --git a/net/core/dev.c b/net/core/dev.c index a17e00662363..72b0d26fd46d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2488,6 +2488,9 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | |||
2488 | 2488 | ||
2489 | int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) | 2489 | int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) |
2490 | { | 2490 | { |
2491 | if (netpoll_receive_skb(skb)) | ||
2492 | return NET_RX_DROP; | ||
2493 | |||
2491 | switch (__napi_gro_receive(napi, skb)) { | 2494 | switch (__napi_gro_receive(napi, skb)) { |
2492 | case -1: | 2495 | case -1: |
2493 | return netif_receive_skb(skb); | 2496 | return netif_receive_skb(skb); |
@@ -2558,6 +2561,9 @@ int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info) | |||
2558 | if (!skb) | 2561 | if (!skb) |
2559 | goto out; | 2562 | goto out; |
2560 | 2563 | ||
2564 | if (netpoll_receive_skb(skb)) | ||
2565 | goto out; | ||
2566 | |||
2561 | err = NET_RX_SUCCESS; | 2567 | err = NET_RX_SUCCESS; |
2562 | 2568 | ||
2563 | switch (__napi_gro_receive(napi, skb)) { | 2569 | switch (__napi_gro_receive(napi, skb)) { |