All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guillaume Gaudonville <guillaume.gaudonville@6wind.com>
To: netdev@vger.kernel.org
Cc: "Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
	"Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>,
	"Chilakala, Mallikarjuna" <mallikarjuna.chilakala@intel.com>
Subject: [PATCH] kernel 2.6.35: ixgbe: skip non IPv4 packets in ATR filter
Date: Mon, 21 Jun 2010 15:05:02 +0200	[thread overview]
Message-ID: <4C1F637E.8010005@6wind.com> (raw)

Hello,

In driver ixgbe, ixgbe_atr may cause crashes for non-ipv4 packets. Just 
add a test to check skb->protocol:

 From fcb81aa89b6819f95349a4ed8c30f0629430aa1d Mon Sep 17 00:00:00 2001
From: Guillaume Gaudonville <guillaume.gaudonville@6wind.com>
Date: Thu, 17 Jun 2010 16:02:14 +0200
Subject: [PATCH] ixgbe: skip non IPv4 packets in ATR filter

It may crash on short packets due to ip_hdr() access.

Signed-off-by: Guillaume Gaudonville <guillaume.gaudonville@6wind.com>
---
 drivers/net/ixgbe/ixgbe_main.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index b2af2f6..3581dbe 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -6019,7 +6019,6 @@ static void ixgbe_tx_queue(struct ixgbe_adapter 
*adapter,
 static void ixgbe_atr(struct ixgbe_adapter *adapter, struct sk_buff *skb,
                      int queue, u32 tx_flags)
 {
-       /* Right now, we support IPv4 only */
        struct ixgbe_atr_input atr_input;
        struct tcphdr *th;
        struct iphdr *iph = ip_hdr(skb);
@@ -6028,6 +6027,10 @@ static void ixgbe_atr(struct ixgbe_adapter 
*adapter, struct sk_buff *skb,
        u32 src_ipv4_addr, dst_ipv4_addr;
        u8 l4type = 0;
 
+       /* Right now, we support IPv4 only */
+       if (skb->protocol != htons(ETH_P_IP))
+               return;
+
        /* check if we're UDP or TCP */
        if (iph->protocol == IPPROTO_TCP) {
                th = tcp_hdr(skb);
-- 
1.5.6.5

-- 
Guillaume Gaudonville
guillaume.gaudonville@6wind.com


             reply	other threads:[~2010-06-21 12:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-21 13:05 Guillaume Gaudonville [this message]
2010-06-21 17:35 ` [PATCH] kernel 2.6.35: ixgbe: skip non IPv4 packets in ATR filter Skidmore, Donald C

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=4C1F637E.8010005@6wind.com \
    --to=guillaume.gaudonville@6wind.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=mallikarjuna.chilakala@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.com \
    /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.