Article View: linux.kernel.netdev
Article #3984[PATCH net-next] net: ti: icssg-prueth: Fix dma_unmap_single() direction
From: Thomas Fourier
Date: Fri, 16 Oct 2026 12:55
Date: Fri, 16 Oct 2026 12:55
52 lines
10973 bytes
10973 bytes
In emac_send_command_sr1(), the command data is mapped with direction
DMA_TO_DEVICE. However, in prueth_process_rx_mgm(), dma_unmap_single()
is called with direction DMA_FROM_DEVICE. It seems like the buffer is
written to by the CPU before mapping the buffer; and, after mapping the
buffer, the device writes to the buffer. The DMA_TO_DEVICE direction will
handle well the cache maintenance operations, however, if the IOMMU is
enabled, it may cause issues with device write permissions.
Change direction to DMA_BIDIRECTIONNAL.
This bug was statically found and compile-tested only.
Fixes: e654b85a693e ("net: ti: icssg-prueth: Add ICSSG Ethernet driver for AM65x SR1.0 platforms")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
index b8115ca47082..6f4a3f64ad39 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
@@ -98,7 +98,7 @@ static int emac_send_command_sr1(struct prueth_emac *emac, u32 cmd)
tx_chn = &emac->tx_chns[emac->tx_ch_num - 1];
/* Map the linear buffer */
- buf_dma = dma_map_single(tx_chn->dma_dev, data, pkt_len, DMA_TO_DEVICE);
+ buf_dma = dma_map_single(tx_chn->dma_dev, data, pkt_len, DMA_BIDIRECTIONAL);
if (dma_mapping_error(tx_chn->dma_dev, buf_dma)) {
netdev_err(emac->ndev, "cmd %x: failed to map cmd buffer\n", cmd);
ret = -EINVAL;
@@ -108,7 +108,7 @@ static int emac_send_command_sr1(struct prueth_emac *emac, u32 cmd)
first_desc = k3_cppi_desc_pool_alloc(tx_chn->desc_pool);
if (!first_desc) {
netdev_err(emac->ndev, "cmd %x: failed to allocate descriptor\n", cmd);
- dma_unmap_single(tx_chn->dma_dev, buf_dma, pkt_len, DMA_TO_DEVICE);
+ dma_unmap_single(tx_chn->dma_dev, buf_dma, pkt_len, DMA_BIDIRECTIONAL);
ret = -ENOMEM;
goto err_unlock;
}
@@ -303,7 +303,7 @@ static struct page *prueth_process_rx_mgm(struct prueth_emac *emac,
page = swdata->data.page;
cppi5_hdesc_get_obuf(desc_rx, &buf_dma, &buf_dma_len);
- dma_unmap_single(rx_chn->dma_dev, buf_dma, buf_dma_len, DMA_FROM_DEVICE);
+ dma_unmap_single(rx_chn->dma_dev, buf_dma, buf_dma_len, DMA_BIDIRECTIONAL);
k3_cppi_desc_pool_free(rx_chn->desc_pool, desc_rx);
new_page = page_pool_dev_alloc_pages(rx_chn->pg_pool);
--
2.53.0
Technical Details
Message-ID:
<20261016125534.36024-2-fourier.thomas@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347334-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-347334-linux-kernel-netdev=dewy.ru
From: fourier.thomas@gmail.com (Thomas Fourier)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next] net: ti: icssg-prueth: Fix dma_unmap_single() direction
Date: Fri, 16 Oct 2026 14:55:28 +0200
Organization: Usenet Network
Message-ID: <20261016125534.36024-2-fourier.thomas@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2767013"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:1YK2HUAD5bTb+12nYrYqV/VnxaA= sha256:znLKwGspEqDO+6hXXXdcALEWTSdALwxKEXFFo6qW0Wk=
sha1:Zz5HS7zg7JKL6FQthVDyd54sEBE= sha256:6UBkugGzClBuDhTaw8Z9AFIG8T3DBdTxlHcqEgyGxPY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id AC769110524; Fri, 16 Oct 2026 16:06:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.748
X-Spam-Status: No, score=-0.748 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id C9icOoTK-w7m;
Fri, 16 Oct 2026 16:06:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-347334-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 78850110517; Fri, 16 Oct 2026 16:06:27 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by tor.lore.kernel.org (Postfix) with ESMTP id B5A653F1FB; Fri, 16 Oct 2026 13:01:41 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D1AD4B04B2;
Fri, 16 Oct 2026 13:01:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OfJUyhjp"
X-Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D6DF4ADD9D
for <netdev@vger.kernel.org>; Fri, 16 Oct 2026 13:01:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792155684; cv=none; b=Kcdq427+m8I20zUxmR4a3bpHaoZgtkDcWdWicD4Sb6xmHoJ23rouGS6HKHk1nzNSBvAp/JYEdVn852Dw64YfgHL3BVHEsGg+wCStZG67mZkCeJlf1i3WO5Bpg3JghD3f3pOxoFLshL9KFwt9Lxs/b//0pyfiesixYKxK5FIRLMc=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792155684; c=relaxed/simple;
bh=zLNCi/x43r+dPYZ+ZjrT65xXB3nkdcDSz7QxgPGzn80=;
h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uFfvyModPtaRExDQSuGc2DfJng3b8G3KSoOYm3RgSnfLGchqhGzI2ktYjHK/V6/PxvLQy8YEo7zRwLpgES7tEIAGMZ/GCwVKEB9HGQTlNDl1YXRyDW9lX+TRWmaAhI+Gj8DUNMSIB8oqrZYN6D01xKJz6EUPTj2YXdTYSZfFw88=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OfJUyhjp; arc=none smtp.client-ip=209.85.221.49
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-48af4ba4425so1001315f8f.1
for <netdev@vger.kernel.org>; Fri, 16 Oct 2026 06:01:22 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792155680; x=1792760480; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=D6SG43mHsHGUs5imH1Rk9lZLOCzzEMaWfOhJt2v6hsE=;
b=OfJUyhjpk5iJiJJBLciyxNtmfHa/lMAgpFGFyWWxfZjqjW1kY3fy8pbMJc9KtPQHBA
CSozXvMJebwvarT8jnWOS7M7BzIJqNobk/pU7T5MkyIdlrGE62i8fnGM6rHXvgg0E2Nl
nOVUzk/RmXX96KiHBwPFLRodHlZhVe38XI8J8tn/2IO4s9qcKBQom2iXkHjHNlSj5SsB
6vidzkJKlOtFqcwbopdsTR0aD/veIE8ImFtwjOpsXagqj6LHZPA7p4oEhxdwnB9B2PbA
25Kfmhk8OhzgTFGPL9tnu7UrQe+BJUsjRqNapuPL+0FVcRtoXr7FW2dCha6FMw0uxxl3
Ig5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792155680; x=1792760480;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=D6SG43mHsHGUs5imH1Rk9lZLOCzzEMaWfOhJt2v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WX0KGlrseQIEywnVtH7t8P2ira6XH88vCXOfjFMGgZShi
QPrTyXw8mYBq42Iw8Bd38C6ScZDmn1nzQks8BGW69TUuOnFDNlGCsA1vSHRyaQR4Vs=
X-Received: by 2002:a05:600c:404f:b0:4a1:d05f:3efb with SMTP id 5b1f17b1804b1-4a1d05f3fe9mr18704235e9.0.1792155679827;
Fri, 16 Oct 2026 06:01:19 -0700 (PDT)
X-Received: from thomas-precision3591.paris.inria.fr (wifi-pro-83-149.paris.inria.fr. [128.93.83.149])
by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-48dfd471a35sm4331624f8f.7.2026.10.16.06.01.19
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 16 Oct 2026 06:01:19 -0700 (PDT)
X-Cc: Thomas Fourier <fourier.thomas@gmail.com>,
MD Danish Anwar <danishanwar@ti.com>,
Roger Quadros <rogerq@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Markus Elfring <elfring@users.sourceforge.net>,
Jacob Keller <jacob.e.keller@intel.com>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>,
Kevin Hao <haokexin@gmail.com>,
Diogo Ivo <diogo.ivo@siemens.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
linux-arm-kernel@lists.infradead.org (moderated list:TI ICSSG ETHERNET DRIVER (ICSSG)),
netdev@vger.kernel.org (open list:TI ICSSG ETHERNET DRIVER (ICSSG)),
linux-kernel@vger.kernel.org (open list)
X-Mailer: git-send-email 2.53.0
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>