drivers: net: xgene: Fix dma_unmap_single() size
PATCH 1/1 drivers: net: xgene: Fix dma_unmap_single() size
In xgene_enet_refill_pagepool(), the skb->data is dma-mapped with length len which is set to XGENE_ENET_STD_MTU which equals 1536. However, in xgene_enet_delete_bufpool(), the same buffer is unmapped with length XGENE_ENET_MAX_MTU which is 9600. This may erroneously unmap other DMA buffers or cause other issues.
Change unmap length to XGENE_ENET_STD_MTU.
--- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +1 -1
@@ -185,7 +185,7 @@ static void xgene_enet_delete_bufpool(struct xgene_enet_desc_ring *buf_pool) raw_desc = &buf_pool->raw_desc16[i]; dma_addr =GET_VAL (DATAADDR ,le64_to_cpu (raw_desc->m1)); -dma_unmap_single (dev, dma_addr,XGENE_ENET_MAX_MTU , +dma_unmap_single (dev, dma_addr,XGENE_ENET_STD_MTU ,DMA_FROM_DEVICE ); } }
Signature · 1 line
2.53.0
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Hi Thomas,
Quoted 1 line
In
xgene_enet_refill_pagepool(), theskb->datais dma-mapped with length
To me, it looks like the mapping happens in xgene_enet_refill_bufpool() and not xgene_enet_refill_pagepool().
Quoted 8 lines
len which is set to
XGENE_ENET_STD_MTUwhich equals 1536. However, inxgene_enet_delete_bufpool(), the same buffer is unmapped with lengthXGENE_ENET_MAX_MTUwhich is 9600. This may erroneously unmap other DMA buffers or cause other issues.Change unmap length to
XGENE_ENET_STD_MTU.Fixes 6e434627bce2 ("drivers: net: xgene: fix: Add dma_unmap_single")
That commit mapped and unmapped with XGENE_ENET_MAX_MTU. At that point, there was no mismatch. I think the mismatch came with:
Quoted 21 lines
Signed-off-by Thomas Fourier <[email protected]>--- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/apm/xgene/xgene_enet_main.c +1
-1@@ -185,7 +185,7 @@ static void xgene_enet_delete_bufpool(struct xgene_enet_desc_ring *buf_pool) raw_desc = &buf_pool->raw_desc16[i]; dma_addr =GET_VAL (DATAADDR ,le64_to_cpu (raw_desc->m1)); -dma_unmap_single (dev, dma_addr,XGENE_ENET_MAX_MTU , +dma_unmap_single (dev, dma_addr,XGENE_ENET_STD_MTU ,DMA_FROM_DEVICE ); } }Signature · 1 line
2.53.0
/Daniel
Hi Daniel,
Quoted 31 lines
Hi Thomas,
Quoted 1 line
In
xgene_enet_refill_pagepool(), theskb->datais dma-mapped with lengthTo me, it looks like the mapping happens in
xgene_enet_refill_bufpool()and notxgene_enet_refill_pagepool().>Quoted 8 lines
len which is set to
XGENE_ENET_STD_MTUwhich equals 1536. However, inxgene_enet_delete_bufpool(), the same buffer is unmapped with lengthXGENE_ENET_MAX_MTUwhich is 9600. This may erroneously unmap other DMA buffers or cause other issues.Change unmap length to
XGENE_ENET_STD_MTU.Fixes 6e434627bce2 ("drivers: net: xgene: fix: Add dma_unmap_single")That commit mapped and unmapped with
XGENE_ENET_MAX_MTU. At that point, there was no mismatch. I think the mismatch came with:Fixes a9380b0f7be8 ("drivers: net: xgene: Add support for Jumbo frame")Quoted 11 lines
Signed-off-by Thomas Fourier <[email protected]>--- drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/apm/xgene/xgene_enet_main.c +0
-0@@ -185,7 +185,7 @@ static void xgene_enet_delete_bufpool(struct xgene_enet_desc_ring *buf_pool)
Quoted 12 lines
Quoted 10 lines
drivers/net/ethernet/apm/xgene/xgene_enet_main.c +1
-1raw_desc = &buf_pool->raw_desc16[i]; dma_addr =GET_VAL (DATAADDR ,le64_to_cpu (raw_desc->m1)); -dma_unmap_single (dev, dma_addr,XGENE_ENET_MAX_MTU , +dma_unmap_single (dev, dma_addr,XGENE_ENET_STD_MTU ,DMA_FROM_DEVICE ); } }Signature · 1 line
2.53.0/Daniel
Thank you for your comments, I agree with both, I am submitting a v2. Best,
Thomas