Commit d3ead241 authored by Guillaume Gaudonville's avatar Guillaume Gaudonville Committed by David S. Miller

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: default avatarGuillaume Gaudonville <guillaume.gaudonville@6wind.com>
Acked-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9f756f01
...@@ -6024,7 +6024,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter, ...@@ -6024,7 +6024,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter *adapter,
static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
int queue, u32 tx_flags) int queue, u32 tx_flags)
{ {
/* Right now, we support IPv4 only */
struct ixgbe_atr_input atr_input; struct ixgbe_atr_input atr_input;
struct tcphdr *th; struct tcphdr *th;
struct iphdr *iph = ip_hdr(skb); struct iphdr *iph = ip_hdr(skb);
...@@ -6033,6 +6032,9 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb, ...@@ -6033,6 +6032,9 @@ static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
u32 src_ipv4_addr, dst_ipv4_addr; u32 src_ipv4_addr, dst_ipv4_addr;
u8 l4type = 0; u8 l4type = 0;
/* Right now, we support IPv4 only */
if (skb->protocol != htons(ETH_P_IP))
return;
/* check if we're UDP or TCP */ /* check if we're UDP or TCP */
if (iph->protocol == IPPROTO_TCP) { if (iph->protocol == IPPROTO_TCP) {
th = tcp_hdr(skb); th = tcp_hdr(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment