aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorGuillaume Gaudonville <guillaume.gaudonville@6wind.com>2010-06-29 14:29:00 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-30 02:12:41 -0400
commitd3ead2413cb99d3e6265577b12537434e229d8c2 (patch)
tree095cf623549694dd1944f6400d545d02c365a134 /drivers/net/ixgbe
parent9f756f018a6d9f83556f972ce7fcd6870274efae (diff)
ixgbe: skip non IPv4 packets in ATR filter
In driver ixgbe, ixgbe_atr may cause crashes for non-ipv4 packets. Just add a test to check skb->protocol. It may crash on short packets due to ip_hdr() access. Signed-off-by: Guillaume Gaudonville <guillaume.gaudonville@6wind.com> Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7ddd60e7d389..a0b33165b989 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -6024,7 +6024,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
6024static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, 6024static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
6025 int queue, u32 tx_flags) 6025 int queue, u32 tx_flags)
6026{ 6026{
6027 /* Right now, we support IPv4 only */
6028 struct ixgbe_atr_input atr_input; 6027 struct ixgbe_atr_input atr_input;
6029 struct tcphdr *th; 6028 struct tcphdr *th;
6030 struct iphdr *iph = ip_hdr(skb); 6029 struct iphdr *iph = ip_hdr(skb);
@@ -6033,6 +6032,9 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
6033 u32 src_ipv4_addr, dst_ipv4_addr; 6032 u32 src_ipv4_addr, dst_ipv4_addr;
6034 u8 l4type = 0; 6033 u8 l4type = 0;
6035 6034
6035 /* Right now, we support IPv4 only */
6036 if (skb->protocol != htons(ETH_P_IP))
6037 return;
6036 /* check if we're UDP or TCP */ 6038 /* check if we're UDP or TCP */
6037 if (iph->protocol == IPPROTO_TCP) { 6039 if (iph->protocol == IPPROTO_TCP) {
6038 th = tcp_hdr(skb); 6040 th = tcp_hdr(skb);