Received: by 10.223.185.116 with SMTP id b49csp5470429wrg; Wed, 7 Mar 2018 12:19:01 -0800 (PST) X-Google-Smtp-Source: AG47ELtTE3i2t5WKUsjRPjIkWVqGpGERoUwc1J7stkh/gCFJJ3WnJ6VQNEkGn1XR8KI7pnixI2Am X-Received: by 10.98.69.196 with SMTP id n65mr23878761pfi.29.1520453941241; Wed, 07 Mar 2018 12:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520453941; cv=none; d=google.com; s=arc-20160816; b=fQJmp+VBBKjt/c+/isuNiWvrJxj28U7VlFo3+xScy4hEl+wWivwIUrHDJCHzz8hY6S vWLbf15ZFnka176CAMj2f0SHk79DNiOIX73qGz3L1YH9ecONxWJ+2I6MuEUwuwkadYJP fg/4sLxkVyVgAnMHmCUHpLc0LhNBp/16OApDwcnXsBG1+kThuhxvyjfLkFzVBhYIrVjA /QfFh7b18Q/oLdPWejjsMrVoF/BMZQP4d69j6YfQP+8bUTr+uyuPRKd46jziz+ZGTjQU ymYjBRGRLUdjcnOJKNPv8GMxtcvMY1HNUSpzujDboJ4Alclidh6Hkhs6o1axg5jdW5I6 8Usw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=I4TPmzd4p1zqFkLpPQXf/+slIbiwZvbqSnBkLnAWleg=; b=YqcjvxC1LP8Qg4wxAcw7nOxK8rC/We3MXC3PI+MN9gxbvSPP1OLjLmftv6RdesDOKY pKkmjRzpR2jj0m55+pT/VxVG6Gwp9JeoH/MKd4aEDKGvQCrp23CZQ8VzfLgKkIeEXKZO T/Oju1Bg4bc9OuttKWd1wCwlpbsShaxLJKsKJJOEwsRY6aU0HpfoMgezLSVj0ZLP9TOi awT62RL3BRvDvfXObycL8PjiWJoQxEcUbIJOa53LLdZbNH177iFmRG233OLoTyZ/xr5S 73caOCszaujy/z2QlyWCn6XVCRsw2adnqkWTkTPFX2bx7wVZCT/+nL8niNEGr9lDQHf1 lVTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si13464891pli.826.2018.03.07.12.18.47; Wed, 07 Mar 2018 12:19:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965195AbeCGUQt (ORCPT + 99 others); Wed, 7 Mar 2018 15:16:49 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43824 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935028AbeCGToe (ORCPT ); Wed, 7 Mar 2018 14:44:34 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2E945EF7; Wed, 7 Mar 2018 19:44:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ambarish Soman , Alexander Duyck , Emil Tantilov , Andrew Bowers , Jeff Kirsher , "David S. Miller" Subject: [PATCH 4.14 002/110] ixgbe: fix crash in build_skb Rx code path Date: Wed, 7 Mar 2018 11:37:45 -0800 Message-Id: <20180307191040.105461857@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emil Tantilov commit 0c5661ecc5dd7ce296870a3eb7b62b1b280a5e89 upstream. Add check for build_skb enabled ring in ixgbe_dma_sync_frag(). In that case &skb_shinfo(skb)->frags[0] may not always be set which can lead to a crash. Instead we derive the page offset from skb->data. Fixes: 42073d91a214 ("ixgbe: Have the CPU take ownership of the buffers sooner") CC: stable Reported-by: Ambarish Soman Suggested-by: Alexander Duyck Signed-off-by: Emil Tantilov Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -1877,6 +1877,14 @@ static void ixgbe_dma_sync_frag(struct i ixgbe_rx_pg_size(rx_ring), DMA_FROM_DEVICE, IXGBE_RX_DMA_ATTR); + } else if (ring_uses_build_skb(rx_ring)) { + unsigned long offset = (unsigned long)(skb->data) & ~PAGE_MASK; + + dma_sync_single_range_for_cpu(rx_ring->dev, + IXGBE_CB(skb)->dma, + offset, + skb_headlen(skb), + DMA_FROM_DEVICE); } else { struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[0];