Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9403810pxu; Mon, 28 Dec 2020 15:21:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqQlduc9/yT/OjD3J8YnRN/6tTLLbRdJho8ojYLsifyYU56ETRD50jKzwU6Nclucd2xgJs X-Received: by 2002:a17:907:d9e:: with SMTP id go30mr42064607ejc.488.1609197703231; Mon, 28 Dec 2020 15:21:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609197703; cv=none; d=google.com; s=arc-20160816; b=KTrcFdZ/SAV3PeP0fjPtTn10XZnHtJK0iItSLMG39VGZeOxxyAuyjdU6Zmw8jYS3Xo 4ImC+wvW5de8w3kTSYqNBHeK4LUQEn5AEXy+8DYEPlY5aYzlb1ofiYLA7Y45e/w7kyT/ afHsWZKnAJGvsJ/c2h+vqvusD0S1kFnBQlSEb5OKLLLQNZ3vQOgjuzkq4v0tV+4Y9KgB glxDTxPpz4qiOKcYhUSs0eKX73eZt3Isb3OFUR5pwsJIU6rsgcuFiZEPr+LZPIWYg1xE DfHP6nVE2G/41aUmM511chGnXgjh+f1mTiBSryq+t7ipmToCoJ9iB9BR0qvta/jbpyD7 RQKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wKC+RdRYANqMoUunWKinplAcaJyczimyNWXAI8yA/70=; b=TqJe94qO2LqRzqGfoBlbhrtxU3s32rhudgapcmVaWiKFSHxMLMzK+WkY2hPXZbeUki DEPr+NB3djh5ThXCfmHDrbtdEWPnY2Raxs4Xse6Gjz7U1sXErv3yxJI2jigH8L61Bo0J nv7Aiiz+knWOm07i0B2ALGE2rHWBmFUYSTED1xLDt/lAp62vgqRIXEntWTqlS8YDbNyw AAq+2yI6/y+lmpw5B7xQXeuRv+KvY3FurRbsAtF3Gs0VQAA57J5MDDCkL4qB+otUysUW QmhIbfN01C6dEtTWf6p8Sr2kKyJ0Q9yGEsLNx66sg6vbe8x6Ra2cEOVvtHnXvZIFqWRK e1zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iglcnpYz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id se15si19296537ejb.270.2020.12.28.15.21.21; Mon, 28 Dec 2020 15:21:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iglcnpYz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437963AbgL1OVh (ORCPT + 99 others); Mon, 28 Dec 2020 09:21:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:55632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502247AbgL1OVF (ORCPT ); Mon, 28 Dec 2020 09:21:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9377E207B2; Mon, 28 Dec 2020 14:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165250; bh=pTNAT20uZOQhm5q/w3LXW0+Z6AtvCK8AFwsi8VJmBdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iglcnpYz5A0+rMp51P0STqsuB6Le3hnQhGmxFwascmMu+lg9G8G3DpME+RKipUg24 cOUXLhiHxlEWw7Y+5qFqvLKAx6GLJH5iqbH1eTDEZZ7AVr5/s+vqrkuHKpCyRqTEf0 B8WLRI2N8hLMDGEjLAx5swZmGCRuayUyRhaguGek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Thompson , Ioana Ciornei , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 465/717] dpaa2-eth: fix the size of the mapped SGT buffer Date: Mon, 28 Dec 2020 13:47:43 +0100 Message-Id: <20201228125043.250012273@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ioana Ciornei [ Upstream commit 54a57d1c449275ee727154ac106ec1accae012e3 ] This patch fixes an error condition triggered when the code path which transmits a S/G frame descriptor when the skb's headroom is not enough for DPAA2's needs. We are greated with a splat like the one below when a SGT structure is recycled and that is because even though a dma_unmap is performed on the Tx confirmation path, the unmap is not done with the proper size. [ 714.464927] WARNING: CPU: 13 PID: 0 at drivers/iommu/io-pgtable-arm.c:281 __arm_lpae_map+0x2d4/0x30c (...) [ 714.465343] Call trace: [ 714.465348] __arm_lpae_map+0x2d4/0x30c [ 714.465353] __arm_lpae_map+0x114/0x30c [ 714.465357] __arm_lpae_map+0x114/0x30c [ 714.465362] __arm_lpae_map+0x114/0x30c [ 714.465366] arm_lpae_map+0xf4/0x180 [ 714.465373] arm_smmu_map+0x4c/0xc0 [ 714.465379] __iommu_map+0x100/0x2bc [ 714.465385] iommu_map_atomic+0x20/0x30 [ 714.465391] __iommu_dma_map+0xb0/0x110 [ 714.465397] iommu_dma_map_page+0xb8/0x120 [ 714.465404] dma_map_page_attrs+0x1a8/0x210 [ 714.465413] __dpaa2_eth_tx+0x384/0xbd0 [fsl_dpaa2_eth] [ 714.465421] dpaa2_eth_tx+0x84/0x134 [fsl_dpaa2_eth] [ 714.465427] dev_hard_start_xmit+0x10c/0x2b0 [ 714.465433] sch_direct_xmit+0x1a0/0x550 (...) The dpaa2-eth driver uses an area of software annotations to transmit necessary information from the Tx path to the Tx confirmation one. This SWA structure has a different layout for each kind of frame that we are dealing with: linear, S/G or XDP. The commit referenced was incorrectly setting up the 'sgt_size' field for the S/G type of SWA even though we are dealing with a linear skb here. Fixes: d70446ee1f40 ("dpaa2-eth: send a scatter-gather FD instead of realloc-ing") Reported-by: Daniel Thompson Tested-by: Daniel Thompson Signed-off-by: Ioana Ciornei Link: https://lore.kernel.org/r/20201211171607.108034-1-ciorneiioana@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index cf9400a9886d7..d880ab2a7d962 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -878,7 +878,7 @@ static int dpaa2_eth_build_sg_fd_single_buf(struct dpaa2_eth_priv *priv, swa = (struct dpaa2_eth_swa *)sgt_buf; swa->type = DPAA2_ETH_SWA_SINGLE; swa->single.skb = skb; - swa->sg.sgt_size = sgt_buf_size; + swa->single.sgt_size = sgt_buf_size; /* Separately map the SGT buffer */ sgt_addr = dma_map_single(dev, sgt_buf, sgt_buf_size, DMA_BIDIRECTIONAL); -- 2.27.0