Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2203649iof; Tue, 7 Jun 2022 23:06:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/CoPwHF7CxqnbhLhIjst0+Gw/k64xLSIGeTbMsnQ0ZOpYDsVqioXDTvVxQVwPnQM8DsZX X-Received: by 2002:a17:902:e88e:b0:163:ee82:ffb with SMTP id w14-20020a170902e88e00b00163ee820ffbmr33245105plg.142.1654668416951; Tue, 07 Jun 2022 23:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668416; cv=none; d=google.com; s=arc-20160816; b=iS2jOlCWmr4fPvjLmQOX19BLP3mnBPW57z7/0GmqdNkIe6q766ol7qoWnN7ivUfJph NOklMS4z8zE/xnJiTkphNd5S6EV3y6/8GX3kVe7uHt2xVcvfb+fqEqtrLCg3zvmYoaQk rVTxkAjWAmwP1sVZ4BuL0WL5Uerfz08eayjQpSS+n5rU/myU5JClYz762bjxJikhiLKT yOU3QB8Mf901JY+GpL0znje9aBR9wDujmbqCskaC+N/2lFBOIC3x2wuPl2N6ynvcc/vq xnXYFDmWhK7XCde5n/FEfxPksUqUXjDkGsWR4Zhwu+JHevOIF1Q4TpaI4663Onxrwfp3 Qdew== 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=+gGxpdYFTuhBuldNkaXVcplbLnQtFCum8pimrSaddeM=; b=rTzTCbd6u+6qUtCATM+BMIeBE+88MaVZBB3ISffqI4CU+YKmoQuWKlUcaoDYXQ5Ezl ZprP+Phw6hKhmZ/UA6T1h6Tqq7utuKi4eHNA+WGlaBWTkzmKvyW95L2KEGrEwfVIBMIb Nv5yVhlKP6WKKHazjGBnXDLu1fx4r3eY79LIxXvOpFrLp6YDgsYv/Ah+x/0ieZSSeWG5 qBJbcSN5wRQ9q4S66mIifJeoxEnslC9k8ECpY/e4gLra5wPfRIaXA0R2akBalnuhJzpn d1U1FMhqp2swFfuCBjJ6PUqt3/O6Ymzh3sxPy3Ed84VlBeEEm4hdlKVTkMMzM4URg99R PdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ehjKjeiI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ay6-20020a1709028b8600b00164db3d3ae3si4004673plb.321.2022.06.07.23.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:06:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ehjKjeiI; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7573DD8D0C; Tue, 7 Jun 2022 22:30:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238780AbiFHBa6 (ORCPT + 99 others); Tue, 7 Jun 2022 21:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382814AbiFGVv6 (ORCPT ); Tue, 7 Jun 2022 17:51:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97635192269; Tue, 7 Jun 2022 12:09:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DAF53B823B1; Tue, 7 Jun 2022 19:09:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5147BC385A5; Tue, 7 Jun 2022 19:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628978; bh=7JNySWG9G7almkc45VVzVriFrHF3dyFSg50wqEO2dSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehjKjeiIAH45gaBW9/rCgf8JhvUDR1VSGx5M7HmHsjZtPALgThTHI4HPXs+OrlqOl 2CnTckDEB5Hj9PO5O5GV5akNY0GKgxvE0XdDAlsjYuQaOpHiPzz3jDbH/EaJVAH9M5 s5+5SxrQF0hA7/0LDv6a6tpuKkj84+0EyHFt0cBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ioana Ciornei , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 525/879] dpaa2-eth: unmap the SGT buffer before accessing its contents Date: Tue, 7 Jun 2022 19:00:43 +0200 Message-Id: <20220607165018.113810611@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ioana Ciornei [ Upstream commit 0a09c5b8cb8f75344da7d90c771b84f7cdeaea04 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 { -- 2.35.1