From patchwork Mon Jun 21 13:05:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Gaudonville X-Patchwork-Id: 56307 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1DF8B1007D2 for ; Mon, 21 Jun 2010 22:57:26 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757873Ab0FUM5U (ORCPT ); Mon, 21 Jun 2010 08:57:20 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:36153 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757828Ab0FUM5T (ORCPT ); Mon, 21 Jun 2010 08:57:19 -0400 Received: by wyb33 with SMTP id 33so2220956wyb.19 for ; Mon, 21 Jun 2010 05:57:18 -0700 (PDT) Received: by 10.216.187.149 with SMTP id y21mr207564wem.37.1277125037782; Mon, 21 Jun 2010 05:57:17 -0700 (PDT) Received: from [10.16.0.146] (6wind.net2.nerim.net [213.41.180.237]) by mx.google.com with ESMTPS id o13sm3977474wej.16.2010.06.21.05.57.16 (version=SSLv3 cipher=RC4-MD5); Mon, 21 Jun 2010 05:57:17 -0700 (PDT) Message-ID: <4C1F637E.8010005@6wind.com> Date: Mon, 21 Jun 2010 15:05:02 +0200 From: Guillaume Gaudonville User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: netdev@vger.kernel.org CC: "Kirsher, Jeffrey T" , "Waskiewicz Jr, Peter P" , "Chilakala, Mallikarjuna" Subject: [PATCH] kernel 2.6.35: ixgbe: skip non IPv4 packets in ATR filter Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 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 --- drivers/net/ixgbe/ixgbe_main.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) 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); 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;