From patchwork Wed Apr 22 17:45:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 463788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id CEFC4140082 for ; Thu, 23 Apr 2015 05:50:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=yzrm3L62; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0EE7FA14D6; Wed, 22 Apr 2015 19:50:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BGGvyT4SUAdJ; Wed, 22 Apr 2015 19:50:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5112AA1491; Wed, 22 Apr 2015 19:50:52 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 2AB921C2851 for ; Wed, 22 Apr 2015 17:46:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 267489526D for ; Wed, 22 Apr 2015 17:46:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jwsF-Ya2YTNL for ; Wed, 22 Apr 2015 17:46:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by hemlock.osuosl.org (Postfix) with ESMTPS id 8EDDB9528A for ; Wed, 22 Apr 2015 17:46:11 +0000 (UTC) Received: by pdbqa5 with SMTP id qa5so280098031pdb.1 for ; Wed, 22 Apr 2015 10:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=90tBAjP6Tx8C9xTJFb52UR/E6OiZZ0uCFquLl1kpw9c=; b=yzrm3L62uhf4jTYio3HOXaWLjiXD1dQd7y8s12U9kgA09Jp7BwmpRxYmnoXztFAdQT 0jTqZjeKD4xhsQtrHBL/O0PIpqCKGSMJyTK8TL5F+WCLESst6oNbXolS9P7jr3XMPaYp gug/K8bz+YgPDTuRNnz6qAcwGHx1LeN45LotsPlzclGNY66PkQN5P/X8Fd1Nt1uxEFpl fQRFJUhkluEFG+jGuznCawyaWyktxtO56sMXqBc/Hevuq3ojf5RdA78bs3ytl8k0L8zI /AtVZMS8FSvUU9aJ5NnJd83zSON2Ib2QcpqQUotoIASqvFmOu5XlRcaflcb0B4kY0qmY D8vQ== X-Received: by 10.70.38.138 with SMTP id g10mr48687856pdk.98.1429724771283; Wed, 22 Apr 2015 10:46:11 -0700 (PDT) Received: from localhost.net ([8.25.197.27]) by mx.google.com with ESMTPSA id id2sm5634121pbb.56.2015.04.22.10.46.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 10:46:10 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Date: Wed, 22 Apr 2015 10:45:57 -0700 Message-Id: <1429724760-10075-1-git-send-email-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Mailman-Approved-At: Wed, 22 Apr 2015 19:50:50 +0000 Cc: Cong Wang , intel-wired-lan@lists.osuosl.org Subject: [Intel-wired-lan] [Patch net] igb: pass the correct maxlen for eth_get_headlen() X-BeenThere: intel-wired-lan@lists.osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@lists.osuosl.org Sender: "Intel-wired-lan" The second parameter of eth_get_headlen() is the length of the frame buffer, not the header length of skb. Cc: Jeff Kirsher Signed-off-by: Cong Wang --- drivers/net/ethernet/intel/igb/igb_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a0a9b1f..7b3a370 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6852,7 +6852,9 @@ static void igb_pull_tail(struct igb_ring *rx_ring, /* we need the header to contain the greater of either ETH_HLEN or * 60 bytes if the skb->len is less than 60 for skb_pad. */ - pull_len = eth_get_headlen(va, IGB_RX_HDR_LEN); + pull_len = eth_get_headlen(va, skb_frag_size(frag)); + if (unlikely(pull_len > IGB_RX_HDR_LEN)) + pull_len = IGB_RX_HDR_LEN; /* align pull length to size of long to optimize memcpy performance */ skb_copy_to_linear_data(skb, va, ALIGN(pull_len, sizeof(long)));