From patchwork Sun May 22 12:52:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12858152 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A497C433F5 for ; Sun, 22 May 2022 12:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345362AbiEVMxT (ORCPT ); Sun, 22 May 2022 08:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344663AbiEVMxR (ORCPT ); Sun, 22 May 2022 08:53:17 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60072.outbound.protection.outlook.com [40.107.6.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F10B4248D8 for ; Sun, 22 May 2022 05:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C6iTKttt9UyVhC0xxoi2eda1NLCLD76/8z7nroJQYqp374VwQ03eMcGZSc7xUFRXB4CiGqBv380hYNLIkrpf9cmt/p3MnA1PvyxDePEJ5UnLGZfxFyDLlx4sglIytbdANVWqkJhcxoymNhveyRev+OJuu/CPtpldvOdbNBWqssTewZRIsSrzgxzO88Zb0zote8pKrZ6FAeIYxIs8WS1VZgmVySrwLyBci2SjLi9J/CT3ZERjzwU45YJnllXB6OM33EaXj4PHd6BIjP1Zv0XJC1xO/qhhiZi5F6U7XvvUIMt1Gn2MqTWr/bwvsyYliBR+FIuja24gz7rBzo3koqJ6kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h+mI6UThyKgzu62DhbXRd3piyXRq/qbr8xieb6WiK3o=; b=nVbVSuNzaAH2OxW7PZeEgCVq3a+b/7bl9TY3J/U9qN87HurlPbdm3FOfA/opQDnWUOTpcUeDFR/24mQKHs+31f9PQWj3+Zx7DLabEWRvnrRdS/JnaPfoOHlcJzENGpQxE84Fh6EMh574ShK/OQlvBu2LncTpF2WL81FRwwfPQ+mI53Uv0islLtCO5UYP0LJt41ugXJ9um475Jd7Lw4ZlFEscA7B1xZCNtOHz0kNHy/wcvD5pOkKOP2dDm8DPaGNADTDC6K0Z31EJeS4MvfdsccxHHmBNlVwHEjb2tnZP6AxWDCLfQyTwHyzBlzM/r4hgIoA3QvFrE7lBMeYNpGIxmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h+mI6UThyKgzu62DhbXRd3piyXRq/qbr8xieb6WiK3o=; b=K5c+lkfMv36aLP7nXJdwwIuP/hWoPuQfKA75E0JFB6Q6mfi+Y62O+41Ij9CNr1OFntRiSy3b261uRJyfXon96ZVmcKyVokqHAOH4wnWiA4Pl1A12RzD8mhA7HDOpn1zbJcDfd2q5n2y3QqQCNYhZXp5jmKvAee4YuJwpdYo179g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) by AM0PR04MB4385.eurprd04.prod.outlook.com (2603:10a6:208:74::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Sun, 22 May 2022 12:53:13 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::482e:89a:5ef4:21fd]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::482e:89a:5ef4:21fd%5]) with mapi id 15.20.5186.021; Sun, 22 May 2022 12:53:13 +0000 From: Ioana Ciornei To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com Cc: Ioana Ciornei Subject: [PATCH net 1/3] dpaa2-eth: retrieve the virtual address before dma_unmap Date: Sun, 22 May 2022 15:52:49 +0300 Message-Id: <20220522125251.444477-2-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220522125251.444477-1-ioana.ciornei@nxp.com> References: <20220522125251.444477-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM0PR08CA0008.eurprd08.prod.outlook.com (2603:10a6:208:d2::21) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e0a24f1-bc5e-4959-1a6d-08da3bf2081b X-MS-TrafficTypeDiagnostic: AM0PR04MB4385:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qeLliPL0+MvDssJGbdh+bV8ANfgyYdGRohUwFFpoGc/tNBF6y9IC7DDECWN1RBy8b+jGS3jKF5ypwNu/ErJ2yfcliIfae92s3n2S3guudB2i9mEdi8pSpPVljNV9MJt7184M7cRuqZPpM1dOj3NnMIdhKCzUaRdot/BIJ8y6ZHRzzMYV8uSoETqxeYnhZRaDrPET7CMxXWKEzqVmPHAv70BM4nZgW1JSXfp8i6+qjh6D3BllodtWgwcS+eHtEqDPQbdBzEjUdGunhh1jScgtBSEhKgjg/iKcBpMmiQ46W9LqyfsSR2x2jVFrW80qNR1umXvVx8Zq+iMvYPvdtR0YJ6Gjm1h3R29h5sBU2l0CJkBasmqdJv9ovvf+uPBB2rd9xW4jdQPiVrsOIJJOWIo7QHvwy7fCwYZHqFDb3LwsFLEMSPFUd+2Km4u6sTPUgYNSOxq7eWtyatEHvyZ/1+xMeLZPxNflVEQYUXajUIzzBbfMZ8b83DpbgryOtI+wmT+r8FPjAhwnNCCus9wNqBUNErXoj+uIFZz6fSaRjVZF8kl5WfPn87WWcWauyhc+Y1yMCO7gOzA7o/Qrtl0faevpeg9vKguDQnUMU99CWAOCdViFKr4xjaIGN8kf9CAiyoGIRDFWEgXMKtei0tDDpDn/sx2uyDFJMCXJOJgW5QEdUPVHenECllic/AEMaveHZcldlN5+gbumI1Jl1nLeX2Vt0fd/f0h0iqSufLHi7HVgdQ3FE509qXmwhkbtLbXrgIWYJmiudMiuT1OAAR2gAtespPx4OaxMK4HgN3gvPtshRHE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9055.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(86362001)(44832011)(186003)(5660300002)(4326008)(2616005)(1076003)(38350700002)(38100700002)(83380400001)(2906002)(6506007)(6512007)(26005)(52116002)(36756003)(6666004)(6486002)(8936002)(966005)(316002)(8676002)(508600001)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OtOR1qH5gkonQQ5vJ/R1vUuFoKrR6tQB9KA+YDH3KkjQq4VqoCGSTGURA1gst/6ryfxuVzs3CCavEAc1w0zL8gAJ6C9UevAd/2Iz043ZCMa2HL8e8mdEPuqX5BVBsWLOBf52G/LgqCbDtcYWTH+vd4I2eaWTymVsYnItajqJ6NGOuBD90HWcACybsMyD5S73z3g2Dt/eetX753ptEAPRbUoOoxLdvu8Ap0bEKIkfTTnmIfK0dJpstGbOdtodzy70XpsnJO0Amr96AS9p+qgCMhgm87hDogT64rdHN0neAX3Z8DCL19coTinm87OnsX4Emuywo/6e+bPSdLGI8ccMYe7zrTg55tyBXAuLSYYFj6HNPNKcb1qevpcfe6a6P2dta14QQjjZWJR/qMETYNgY90CnzOmoa3LLx8pbq4krLzwemRZhWl3KZvMEL/inps1Q+pbZ2nQ0Yy/GwyOIoGSBQwYRVOZYiioT6ifM1Zo6T0FL+iShej8qYTENKQlh+M0uJ2dmLV0BvfI4GA7FP9UVGeTJf1daX4gTeZUldjTZUFTnpjbylCLp6kd50cdIr2Ggq5S7XkJHUB+48vwdp/13n4QGygBCatjgvQpzXANl629Fc4C9ZbryNZje+WdZ5T1j8R7kMchtfPHnn3GgCxrmpvcCEwlqjIo4Xoo6ZQBQsCDtR2hixe6y+j4pbKlZHbNSiGuPrGEa5vRqYyXWgaKzqsoZaGIwbn6MK5qwWLF04O5t5riHtG5uVlm4t9elHQ7gUumttSW8JioJ7hOBx2p6I9ycXnfqnvmBR/UjT7T1an0X/Hp/0q4AAD8kooPJq1jPHdbKEjfXdq1zWaPpHB+F/V8p5/T0zp2xKqlNn8Z0GLXo3bf8g1pKunnZxEqAaGFwQANxJX1UqQMnlvr80Fp3VDU64se+gLAsP6BsVWrykAw1c1qLs6At0nezFBkW9+vBNg0VI9zWfS9TRuLu8nTmqYI+n7O33NCdrtsrIrNvnYqSw55jVVa5NOdFUpZsJOzjM87oTqMrJMsBImm5+M9PP7BH0QbuJvUbx48d9eE89zAcrADEHcgxVBoLD5qNVOmuT2hwKe1+ZFTHCAYBWBEDhikaTwwtrNZAvEDn/ZnQ+kgoTfo+miz+8kMroZFSavbEDuOvw9vbc0foGjs9JKyKIUIejuxAtSIsptEz82a1KrPi2N9p0pPTtPE4RQmqmLjFtrW7HL22i59K78pm1qUJ6wf1Y72mlok3CPgi1zCGQk0MoJKhjZr7P5R5BK4a7tqnho9FZElvIa0o5PqBMwvwNS81NFFu8kYuzlRpuip1wAjDeBMElObJ/KhIuRsrU2/ky8u8RGZPot8fp74Dn9jTpOtgdKApPKDPCOIyoCjTBlQhDIJu4nZja5+Ul0hROjt6YtfDMbtgMmLOn3501djYfJ0CqPU6xkE900RiYqjVdbJmiLdI3uYxBHpb0DFQSs6xF9nLStOKEygyMUH6IgAlvWZF2f+AZoyCF28oAr4LyHBwh3C/y+Lulk3Qp/RptD+lf3bweqGCKpQ3N7NNE11tbgjn1b3UdaNhywiD3GQDqbxwlJ4nEW6gNdBoKoy8uog6vYasIvBaJqXzDUe4f8L49VJaffEU0NmadvtP/OE5UgjXEpIt3XAyvUt33S8kVZEq/qHtXUeBzagNXxCo0LA+FYj+QSDwaj+BOxGEivHOdOy1GhPZ3LrRS9aYJRa0SYLO5fNcRNjVNoS8ukN282FJQ7QwQBoVJKnSZBdzAnoE450= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e0a24f1-bc5e-4959-1a6d-08da3bf2081b X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 12:53:13.2183 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fuFEsvh4gMG8S7C8/HkvUNFUQwTk6FB6J01PQaFuuhEIeIVxvYWMtz+7oppD1X/OUvvcxUo822pgnFq9ekExcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4385 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The TSO header was DMA unmapped before the virtual address was retrieved and then used to free the buffer. This meant that we were actually removing the DMA map and then trying to search for it to help in retrieving the virtual address. This lead to a invalid virtual address being used in the kfree call. Fix this by calling dpaa2_iova_to_virt() prior to the dma_unmap call. [ 487.231819] Unable to handle kernel paging request at virtual address fffffd9807000008 (...) [ 487.354061] Hardware name: SolidRun LX2160A Honeycomb (DT) [ 487.359535] pstate: a0400005 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 487.366485] pc : kfree+0xac/0x304 [ 487.369799] lr : kfree+0x204/0x304 [ 487.373191] sp : ffff80000c4eb120 [ 487.376493] x29: ffff80000c4eb120 x28: ffff662240c46400 x27: 0000000000000001 [ 487.383621] x26: 0000000000000001 x25: ffff662246da0cc0 x24: ffff66224af78000 [ 487.390748] x23: ffffad184f4ce008 x22: ffffad1850185000 x21: ffffad1838d13cec [ 487.397874] x20: ffff6601c0000000 x19: fffffd9807000000 x18: 0000000000000000 [ 487.405000] x17: ffffb910cdc49000 x16: ffffad184d7d9080 x15: 0000000000004000 [ 487.412126] x14: 0000000000000008 x13: 000000000000ffff x12: 0000000000000000 [ 487.419252] x11: 0000000000000004 x10: 0000000000000001 x9 : ffffad184d7d927c [ 487.426379] x8 : 0000000000000000 x7 : 0000000ffffffd1d x6 : ffff662240a94900 [ 487.433505] x5 : 0000000000000003 x4 : 0000000000000009 x3 : ffffad184f4ce008 [ 487.440632] x2 : ffff662243eec000 x1 : 0000000100000100 x0 : fffffc0000000000 [ 487.447758] Call trace: [ 487.450194] kfree+0xac/0x304 [ 487.453151] dpaa2_eth_free_tx_fd.isra.0+0x33c/0x3e0 [fsl_dpaa2_eth] [ 487.459507] dpaa2_eth_tx_conf+0x100/0x2e0 [fsl_dpaa2_eth] [ 487.464989] dpaa2_eth_poll+0xdc/0x380 [fsl_dpaa2_eth] Fixes: 3dc709e0cd47 ("dpaa2-eth: add support for software TSO") Link: https://bugzilla.kernel.org/show_bug.cgi?id=215886 Signed-off-by: Ioana Ciornei --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 4b047255d928..766391310d1b 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1097,6 +1097,7 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, u32 fd_len = dpaa2_fd_get_len(fd); struct dpaa2_sg_entry *sgt; int should_free_skb = 1; + void *tso_hdr; int i; fd_addr = dpaa2_fd_get_addr(fd); @@ -1136,9 +1137,10 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, priv->tx_data_offset); /* Unmap and free the header */ + tso_hdr = dpaa2_iova_to_virt(priv->iommu_domain, dpaa2_sg_get_addr(sgt)); dma_unmap_single(dev, dpaa2_sg_get_addr(sgt), TSO_HEADER_SIZE, DMA_TO_DEVICE); - kfree(dpaa2_iova_to_virt(priv->iommu_domain, dpaa2_sg_get_addr(sgt))); + kfree(tso_hdr); /* Unmap the other SG entries for the data */ for (i = 1; i < swa->tso.num_sg; i++) From patchwork Sun May 22 12:52:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12858153 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5B9DC433F5 for ; Sun, 22 May 2022 12:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344663AbiEVMx3 (ORCPT ); Sun, 22 May 2022 08:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345368AbiEVMxT (ORCPT ); Sun, 22 May 2022 08:53:19 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60072.outbound.protection.outlook.com [40.107.6.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9E8C245B2 for ; Sun, 22 May 2022 05:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BqahMnaUWZLs/ClZlrDKVnNQDczSZWpYjvGT+9ZclFlbL7uPmguH8TeCtyV53Ja8iN61AEERIcoYO8EHgK3vvPZxsA/o4J3Zbfm2PcXbqjob89OJbNqWvq+4MvmGWl8d1BRcAm+kQzO7kRGxbsftd/iXeJilSzUVj1d9NikCEVBfGLkKULEJx9GGY7HieCdK43vTMlErv1EqHrUnRKdXTvk8mkOfzSC5bBxovV9LSFSYtvKVrCK4qadEbF4VF+ZQam2JUprF3M5VVoponTa/WcaihFf3PX0U8ySKCraE5wKkteRHz77Cek8M3hhYhdjUHr8Sy79myaL2fu4BeS4KRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gm4maMoYMzs7AusjpRCV83EZa264bR4z/hZZ9hlDxLQ=; b=HIb7A5Ukuelyv0k9x1ZOkByb3GWBrZGOPLq7PsYEvuuprF91EiTZs1Y8GsYdMOcQ1Y/OeM7gRYBs68RGBVLH4Ei+Fn4fx9iW6H2So2NJpJZvsb2J0PpvImu3N4Pg89Wd2phCrLbhMp2nL53Op/xYPvnbD30uCfXgdf9NoWI+T7k38Uk2QtUnYjaJv9PCojmD1fy7irmQmi9qVoajsqn8LlzjHDo1uzyf3kLo0RWNa5uvlBfC46E2YDz6HdhJOYch6JDQdI3SDWsCRjkqbf/s4wmiRSpfaXpQ9VsuQCflY+LI0afEgnamy0DSLBFHm9Ic7mdvXRnCicqE1azEY1FclA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gm4maMoYMzs7AusjpRCV83EZa264bR4z/hZZ9hlDxLQ=; b=dvr2nyNGn8OasKfX/KXHayhPwY5yRoonNMvWX50CNba2nnDk/ZQxseDL0OkaiR15NhI5jNv1yXuMAlMJp0w0zQESr3WJ2GqkmXOv+UGI0ZKWdl42xaFIIlN6NCq2aBOCmCrs78E/0/gPZ9ER6w3gTvlYPqrW5ntcrMen7MyhlBI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) by AM0PR04MB4385.eurprd04.prod.outlook.com (2603:10a6:208:74::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Sun, 22 May 2022 12:53:14 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::482e:89a:5ef4:21fd]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::482e:89a:5ef4:21fd%5]) with mapi id 15.20.5186.021; Sun, 22 May 2022 12:53:14 +0000 From: Ioana Ciornei To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com Cc: Ioana Ciornei Subject: [PATCH net 2/3] dpaa2-eth: use the correct software annotation field Date: Sun, 22 May 2022 15:52:50 +0300 Message-Id: <20220522125251.444477-3-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220522125251.444477-1-ioana.ciornei@nxp.com> References: <20220522125251.444477-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM0PR08CA0008.eurprd08.prod.outlook.com (2603:10a6:208:d2::21) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bfa04b7-274a-416c-b62f-08da3bf208ac X-MS-TrafficTypeDiagnostic: AM0PR04MB4385:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AXMSZhZMbX1DlgyDkSDOVAmcQ9K0tUJi7UQNIdamCg1ilDL0agPJs8j1dOD+SpiMARl57lFySKdebasZ10c76r1x3Q3Mic3HbfFIxordG+MW4C/+5a48zvDxkFeVqveRFr6coi6GrXTRYsmGE39qyg2+N6ozSpbRIegLwmrUZ249SbT5LiDCfIMpssK70nvuhHbg69nsC5Mazcl3ySpoe4h2LDCP3IjMoj3VtEIxPVFNK62mwIfMLzdCZ7ocDqkizNCO9/pjuNGxHXH2uC+XyLxk69GX2L3jQhjtyglLAMgo4ZPGT+KT+7nO/U9EughHLPPjsLuNjYQIg+NUhk9NG8o+NpZPu1gVZ54H97WfVR1AkYhnWpzNAy0Bgf41FZxtMDEz2ytHZrFMoTYOXzRcSAeUlgHi0keFNUoSsGGJEBExhZmdZlwgg6iITE3ouxFQMStEco0/71ZnY0plh1F8bX9+HIdw3Q56DOv7eIQd/FrESHO/kBLP5AheC8H9O0XdnceRDVxVCSKlbR2B8NkDhrdqD9oeDfx9oBB6i/78Cv4KoJZDR4uVPIXF0OqhFpyhU+x/5jQzCJYAZK+k3iH1+JXythaxMH/7gkjw0+/TcCWvv6RYoJ0fjRWJt179U+hD1Esp051+pMmK1BKr1SIKldwLNRcVWMqNlvsioepo2qS++epBYfJ2rYBC4how4nUsi0LdP6G1pPcVVMezljyoWg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9055.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(86362001)(45080400002)(44832011)(186003)(5660300002)(4326008)(2616005)(1076003)(38350700002)(38100700002)(83380400001)(2906002)(6506007)(6512007)(26005)(52116002)(36756003)(6666004)(6486002)(8936002)(316002)(8676002)(508600001)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ofwQcas39f58UTtqJmmkjMzp5XQdSiEZVc1VLyo/kgCAXLMSny6+C16GIsEgYR2M/j/V4aiQIum6q5aERDD/tXOd5Mt3erBQbqvJiJNEXTlQhvdNByQeKhFuDF4CIiNdlYjLcDwCYSOHvFzFtIy3ARobiUyfN6h3we4TdW1ZhQyLsBArHOKTcN7xoyvOC45bEw6Zr5rUcWeLn8rzPhu9ydWYS5lbq/1CxbOIEZywLDXnEIUT3fx6aVDG/wCXAGlLwIjbMZFaPpfOpIkALhQhR+NH5YfrPNnYEoM87HN1L+paGCikjIh1YhAcXqVVgvhVtibcPSt5cl/UkgH/HsVeZf360SXjRCxIb5mtwLi2iPCd7B7C3rrOg0rZFRP+UxfFjtsyDEKUBfpShkIkfRTSOnL+txx7fsP8G8ZG6YUrgEGt4uikS1yZJE7BhMBwhaH/a1pHTcyqH6cpUneAx6b8ailHn1g0j+HO+a64SxWIALM6qpVh66YBIc9kGv1XgaxNEUrxbRjrYQXZeFQkwJgNQuG2uOaU85NC/lm8N9YS/J7vu/M8zPF6r8xIOpYFHb5K2CbVljm2VAoRdNHZRqk90fhthqWuzlNK3lLCJTOuLverhjusR2rPSgXb2mukU8XAm+Sxk2q83ZF9FvVgq04syyY5whAZGpp3awxazVQTINVxVUQ0q+/gtrhLbAteE0TKMqfJD9FAPy4WvEfJRsSNV7RAy0cMD0FNaFyOaWfuX2eBpEqvoXuNNNm/kjDeGFotfEEraQg7oiNwd4wAeuaRXWWP1bqVPE1pVApC65/LcP+QM8xD29WYccFmH+YrsjtJCH/4i5MjIS4kht6vxQ8dzrAomF44/FTsaXNDXo+YsEPUSdnZW575rIhaKGhgwji+md7o8OuRRkY6F2uHK6eG3dD1o1KmoJvktFA7/AqLIOjYrLz4Lksowdo62288dKFfb2Gnc4LRFJDSiZ/hNybBEQ0VqxpBHe30S0Z7voHXIxKguJww/N+z/id+Pk1VNpcL3N39J07LjjxnBP5apQ2xM/4khlo8LdaWjJyaJ9w5Bf3W4lLit+ypgp1ZhbVGde3L5x11EQV6C6SogT4Z1SBWabCr8ZubVZIS0CBEqIU8GoVcTPinAK5Ze8DjUXVOTW0gbZn3X0DVp28HuBH7TMR/T1j2de3RQyNm29t/aOIW7iXcXTDeas25bCjLoiwnsukor+AIuzfUnmrXw3tSf3FV3t0u0KQzlOpRLeZNadkHygcA2oe4E8a2CzpB/+lPXrhzR6yPbFSn7O4y/7E9fyQonVHhmPfciVZVkJjrR923LlBMcSmrUz3W3osfHi80wgeeTPMlzb71cC/wtGvkrIgq2pmpAaLDUZIxNbOh0PRee5Xh6C7lt1fKo4dXnuh2tOMVbTHH/c4hiKKt/1Yg50m4Cv/fRHujlveE6H32PNHwKV88MK/W0GD2urWdv2WB9XCkYPs15y00oH+hR3ifEW2rA+iWNTbSBfaSyckeI0kSnKUKjTIXJCsA2a1QxlNekW6GcT6vGd/vS2SBQF40m+BvWeAn8klkwcL5jvYFV0CsDDO12grrA66U1rBU1dxMklcnue5jwBhfQ5P45lT3Hr0u5WtGZdzVZYPoKgDvI72THQ2WKzl68j2C/bqQps/5IeQJwdyRorWisMjOurMsfYyZopsD0Vkt+m/YGzeou/21VYpcABNRdz56pcBgxmzWGYTrAUZy3G+6x77Ocu+kDznPAuzRlJfLDIL3u/7g1ZskC34= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7bfa04b7-274a-416c-b62f-08da3bf208ac X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 12:53:14.1413 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zjv6ohSYyuK/1Cztleb87WofPeZybpjwL45H+WvRJSE/7WL/oxJmuRHvI6rvrJiG/pa99IoTwmsHOOyN2dyKdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4385 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The incorrect software annotation field was being used, swa->sg.sgt_size instead of swa->tso.sgt_size, which meant that the SGT buffer was unmapped with a wrong size. This is also confirmed by the DMA API debug prints which showed the following: [ 38.962434] DMA-API: fsl_dpaa2_eth dpni.2: device driver frees DMA memory with different size [device address=0x0000fffffafba740] [map size=224 bytes] [unmap size=0 bytes] [ 38.980496] WARNING: CPU: 11 PID: 1131 at kernel/dma/debug.c:973 check_unmap+0x58c/0x9b0 [ 38.988586] Modules linked in: [ 38.991631] CPU: 11 PID: 1131 Comm: iperf3 Not tainted 5.18.0-rc7-00117-g59130eeb2b8f #1972 [ 38.999970] Hardware name: NXP Layerscape LX2160ARDB (DT) Fixes: 3dc709e0cd47 ("dpaa2-eth: add support for software TSO") Signed-off-by: Ioana Ciornei --- 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 766391310d1b..f1f140277184 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1148,7 +1148,7 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, dpaa2_sg_get_len(&sgt[i]), DMA_TO_DEVICE); /* Unmap the SGT buffer */ - dma_unmap_single(dev, fd_addr, swa->sg.sgt_size, + dma_unmap_single(dev, fd_addr, swa->tso.sgt_size, DMA_BIDIRECTIONAL); if (!swa->tso.is_last_fd) From patchwork Sun May 22 12:52:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12858154 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24B93C433EF for ; Sun, 22 May 2022 12:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345440AbiEVMxa (ORCPT ); Sun, 22 May 2022 08:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345407AbiEVMxV (ORCPT ); Sun, 22 May 2022 08:53:21 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60072.outbound.protection.outlook.com [40.107.6.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C05F0248EC for ; Sun, 22 May 2022 05:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T9qqFKNSjzMX2mslYMzPWhW3wIfAr5yObU/jyGum2g6tS05nXPpzCJL4LWk1ySNfFanMfnlO9BK33wKkjRFQY5x7srQNQlQas8gABt49w/uUAsqa69LChiERJIHzBYSz9Rh1j+ObBkaC3TDmTNXh/my2CNRtw/C9Yzs7rKczwybXiU846jWDAQ9n/6zyJCxkBNFxFuJVJ+zWwPEwdT3wjT73MsTeAlm3aT5mbc+b5Va+RVetxkgpQ4BRwnJrOXIaW2GkeO3WmHFXu+7m3yd8k1iPRA6gsgaUl1qzRbk9BCbnP+9ayqnnU5+sc3fVFVuQ+6QDvmmWSBLU/BqX+RZ2HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ejblSvaw5L7bP9z3b6YJIZ+yvbCijbT+rusXU3NcDws=; b=aj0r5+K/kLsBBAbShcn9dTn2it+6L8InuBkw0HUG+yijHMbHgpSj9KuBNboMAvXMGZm24O8F/sKnvJBqi1pA4wZCMt53wRizCYv3GiSdy1poDB6ehV4V+IqRe08aiik9EQEMU70+SD2YWBPPR5Icawrq9jEsRka2fgDiVyv7xyIxGtgVvcr8EeVKqupBn13yHHMHc4C9+X+F9oY9k2I4Fhp4rS2tgeZ1phjvs3zZPEvNQDK2EPzzFDyxUm02F1yryk194qcP13ZjIomrUMnEWCwHSJke5sUWBv/H3/yi7j6UidTaKKulviDLQc3ZAh9hmVrT62CFgvS3t0uPhdjlwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ejblSvaw5L7bP9z3b6YJIZ+yvbCijbT+rusXU3NcDws=; b=PQ1QZ4IBxrecZLpeqqI3ANYkVnxjlSKrdeSbhjlCzfrU1ILntRPrz2K4pi7cR7NZGuq53cbNh5/MoK8bXpyARfiL2aRMzIiBvvE2nAzyx2c4ZAKvM++sfoLTcOtTEB+7zkUZfrZqkIMIzAMmcDcPXKSWB+fY9hzn7ig3Ly/IAy4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) by AM0PR04MB4385.eurprd04.prod.outlook.com (2603:10a6:208:74::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Sun, 22 May 2022 12:53:15 +0000 Received: from GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::482e:89a:5ef4:21fd]) by GV1PR04MB9055.eurprd04.prod.outlook.com ([fe80::482e:89a:5ef4:21fd%5]) with mapi id 15.20.5186.021; Sun, 22 May 2022 12:53:15 +0000 From: Ioana Ciornei To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com Cc: Ioana Ciornei Subject: [PATCH net 3/3] dpaa2-eth: unmap the SGT buffer before accessing its contents Date: Sun, 22 May 2022 15:52:51 +0300 Message-Id: <20220522125251.444477-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220522125251.444477-1-ioana.ciornei@nxp.com> References: <20220522125251.444477-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM0PR08CA0008.eurprd08.prod.outlook.com (2603:10a6:208:d2::21) To GV1PR04MB9055.eurprd04.prod.outlook.com (2603:10a6:150:1e::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 242b1aa0-dad6-4dd2-64fa-08da3bf2095f X-MS-TrafficTypeDiagnostic: AM0PR04MB4385:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H3uznQQOlD2rKJfLnYqI1XKVZkdnPmpf1PHF6k0NixLBZiSi7DhB/IKn7EAscqqq2l0VZjDLL2U3jSr7lO8UMBzAIu8ctMF3GMWEWpvX56NiRi/StVr8kVlAYHPlbp9NUVBwfmuXom8DR/D5lPgdwIj88k5nqduJyWJ1pkjm/pLbkWZFMU102u7VAjmpeFcTWP0HMZj0hCoLD/Plu9Mq33JAEWw3NrIk78SZHTNSVRCGj6vixC59jdWsA3iUe2o5T7NOo6vp7ya4VcdvHgbFEQJQsVlvTPrPBKMClu9NC7wJGCgwxyngTdFWIOD4IgL1z6egjAUpoH3G+/mAa48AHKR3NxY5HQtAZbNVxy0ZyNBp4Cm+EA2TV85ej06dicvTKIsPooyorvkWQnw0yojq5AYDU35utc9AATIYd9Z48eegYUIqS4xdwxV43eWpfW8+oVXX8LxTvmiYg4pskPkwCahztqQM836Rb0FOzAiTuqdc2kOFYo/cm3rGX9dW8ecLwYa6VqzOuBvLEgolOAwOc0ugAhLpt/HseNLkCSq7lhn1iqXtnm5Cdlvgy6OD5Ef/XULiQUkCs9GgLitbqiJZEBg47qnJrj9O/By5JWTpHzt0qCXSJwvroE2V/K2hEZe/7f4q4IJu127MRC3Fguok1T4BIeBYcze3aURlmfEFNgqg3zWtAwObd5dxmfgPCpeAvLORMGF17biqc+AhCq6tZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR04MB9055.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(86362001)(44832011)(186003)(5660300002)(4326008)(2616005)(1076003)(38350700002)(38100700002)(83380400001)(2906002)(6506007)(6512007)(26005)(52116002)(36756003)(6666004)(6486002)(8936002)(316002)(8676002)(508600001)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aLslLcr0vQL9Gu3VINMDfHjyNaGnvSEDcmPbJG9yDf/8nAMi7xI1qyIKLPBC9877GbPpPE4M+qd5Owb2syk8IS2sP0EOmTIwD2KcuX8HIFiFmHBRq+7JYOZAb5XZtTYbJ2OB0H1wmWLnLMBSbiemorJLOlgW6fcKbs66T3SMhAl18if/miqZx6nFvStkPPNk4rocawae8Tw4nz3yREsdt+5vqfS9tkOaP8X/btStds2ihkzyqqhCidsHp2iwA3Mo537xX80sGr//ke7XxNz3/1EVfzmzXMaEiE/DzznO3K1t/Ij3ES5wsbpSOQ/uula3vMeB+5Qi1YT0YjwCfnXn+wJ632yIjsB5/Bwn8OGept6Qp0m0D6eEin2EmiFb7RHkx24KLKL9wy1n17s/gY/YWPRngiE5QlKRKJHo7lM0f0vQi9JyH/wQOWHRbBLrUnqyAQzRHtdxF0d4JKRP/7j934ON0kgCFm99EO9f8xaWA3GAtfV4ZiN1ohazTGEBV+BFkl/y8MAuehKM93+pLYrJkXU7JCimuy5zDe11p81DFPJiFYpOD07eiA69jgGY2uqG/V60hGlsGgC8DIxKOIsL3lFyx7/3R7Jq8i3gIl2wsUcOOpBhNz6X2M43p2ZvHj3x3RAU7M6mhnOXt7SGWYPQwiqIKMQei/IsB3Mz0RrfXvxv20OQ90fD5Z/x4NJySowgvVBRdWdciZQ3noXGBUt64EdOTU26VmSt783VUGztDfLHV8ZnBvLuL+indP2+If1/2j1qXrzX0Jb9pfy4OqcYEwqOF/V1M5dHwTAo8VkSJeQrUC/EVZDPS4T/+7rLlju5n2hYOt3XiACe1meFmhZ9yx0ZzdHOgv4fd1UCyKkzFUwguMMgvy+z0jYd6qwVu4MzqUNP1VBHKWoixi55X9ByVxcZWTtpaew8z4YmIKuPkdqxhjcy1XYrPBYN23Kv0prEWdDW9T1iIbuSaC6eLP1MRlNDoLwIUdKQb4X24BMBjwY65uWGzNgLYoFugc8QlYnIVpJvOLgyASSeBPrdHiQRpGKQ41EXBw9kcirTD4PIVm1jfDH4w1c7PUW/MKv7uon26LqStux/RngtyfiKboGgOxFVpwawMSf0b/K2Rp32fM/xrKOEzvERjjHs4vZKLgcGXQf8jUbKecjNZ/l2gm7Ky4uQEHhnjYfGOdvKPUq60z9eQWrZnlFB6VOF+kDSs/qJnCgwLjr/hnVBzq34D0jsrUNdsI+FEWlO8SqlRg6yE5nlWVZ6up50MZx+cSvvHJPHYVvMtS+EDvVM+JkQUTCwVfUfQHG7zsD+QdHKUHBWcBq9dQ7+fTtlgoQ+ZiTgfQ+p+Zpk0P2Kz+L5eO2REEzJ2+i+5qANLhis1pN7VN2AizpaNqvuMnB5LnT6JkK11AryC8Qx0QQeUWUwXvwKvsVVmuBCdtmZgXiMjtpFgHuSuuWTsQ/ObtOR+YF6i5dw4V5htx8DW4aG5KsN2leQmCXKctKU8Nmykl4I37AxbB1EGLWnHoIsbUy5MqDJHG7URB8xRffzXf9VPrCyAMtiVsqeR/m1fPRNt+CvubzQfJ/OZamCTRMTynhfWgdDqDZqFXhdnYVPJ7jtj8LWw2E3Uo6xSn/XR/2H5bRqv3WiDxadnjew6dVDJjbqccXtLSKKrqGcOws6dpmBcn48xlgS4PvEyN2JYmSWadl0cR4ad3lInaQ8b2WmKngU4Vk3+nhE9wBzBtULDvPHe5cPUsirtIlVfGlFHGgq0nRD4hjYTStSMV8= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 242b1aa0-dad6-4dd2-64fa-08da3bf2095f X-MS-Exchange-CrossTenant-AuthSource: GV1PR04MB9055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2022 12:53:15.3435 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d3Ntw7O0O7A5eE+QCoViVuafzvovyVQmxc5fR8Bel9cK51Ir6YdPRDNEnCuc+3okY9poUffancRM5JmHk3HV/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4385 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org DMA unmap the Scatter/Gather table before going through the array to unmap and free each of the header and data chunks. This is so we do not touch the data between the dma_map and dma_unmap calls. Fixes: 3dc709e0cd47 ("dpaa2-eth: add support for software TSO") Signed-off-by: Ioana Ciornei --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index f1f140277184..cd9ec80522e7 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1136,6 +1136,10 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, sgt = (struct dpaa2_sg_entry *)(buffer_start + priv->tx_data_offset); + /* Unmap the SGT buffer */ + dma_unmap_single(dev, fd_addr, swa->tso.sgt_size, + DMA_BIDIRECTIONAL); + /* Unmap and free the header */ tso_hdr = dpaa2_iova_to_virt(priv->iommu_domain, dpaa2_sg_get_addr(sgt)); dma_unmap_single(dev, dpaa2_sg_get_addr(sgt), TSO_HEADER_SIZE, @@ -1147,10 +1151,6 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, dma_unmap_single(dev, dpaa2_sg_get_addr(&sgt[i]), dpaa2_sg_get_len(&sgt[i]), DMA_TO_DEVICE); - /* Unmap the SGT buffer */ - dma_unmap_single(dev, fd_addr, swa->tso.sgt_size, - DMA_BIDIRECTIONAL); - if (!swa->tso.is_last_fd) should_free_skb = 0; } else {