linux-yocto/drivers/dma
Dan Carpenter 4bb0164383 dmaengine: nbpfaxi: Fix memory corruption in probe()
commit 188c6ba1dd upstream.

The nbpf->chan[] array is allocated earlier in the nbpf_probe() function
and it has "num_channels" elements.  These three loops iterate one
element farther than they should and corrupt memory.

The changes to the second loop are more involved.  In this case, we're
copying data from the irqbuf[] array into the nbpf->chan[] array.  If
the data in irqbuf[i] is the error IRQ then we skip it, so the iterators
are not in sync.  I added a check to ensure that we don't go beyond the
end of the irqbuf[] array.  I'm pretty sure this can't happen, but it
seemed harmless to add a check.

On the other hand, after the loop has ended there is a check to ensure
that the "chan" iterator is where we expect it to be.  In the original
code we went one element beyond the end of the array so the iterator
wasn't in the correct place and it would always return -EINVAL.  However,
now it will always be in the correct place.  I deleted the check since
we know the result.

Cc: stable@vger.kernel.org
Fixes: b45b262cef ("dmaengine: add a driver for AMBA AXI NBPF DMAC IP cores")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/b13c5225-7eff-448c-badc-a2c98e9bcaca@sabinyo.mountain
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-24 08:53:13 +02:00
..
bestcomm
dw dmaengine: dw: Select only supported masters for ACPI devices 2025-01-02 10:32:02 +01:00
dw-axi-dmac Avoid hw_desc array overrun in dw-axi-dmac 2024-06-27 13:49:04 +02:00
dw-edma dmaengine: dw-edma: Do not enable watermark interrupts for HDMA 2024-09-04 13:28:25 +02:00
fsl-dpaa2-qdma dmaengine: fsl-dpaa2-qdma: Fix the size of dma pools 2024-02-16 19:10:42 +01:00
hsu
idxd dmaengine: idxd: Check availability of workqueue allocated by idxd wq driver before using 2025-07-06 11:00:06 +02:00
ioat dmaengine: ioatdma: Fix missing kmem_cache_destroy() 2024-06-27 13:49:09 +02:00
lgm
mediatek
ppc4xx
ptdma dmaengine: ptdma: use consistent DMA masks 2024-03-06 14:48:40 +00:00
qcom
sf-pdma
sh dmaengine: shdma: increase size of 'dev_id' 2024-03-01 13:34:48 +01:00
ti dmaengine: ti: Add NULL check in udma_probe() 2025-06-19 15:28:29 +02:00
xilinx dmaengine: xilinx_dma: Set dma_device directions 2025-07-06 11:00:06 +02:00
acpi-dma.c
altera-msgdma.c dmaengine: altera-msgdma: properly free descriptor in msgdma_free_descriptor 2024-09-08 07:54:46 +02:00
amba-pl08x.c
apple-admac.c dmaengine: apple-admac: Avoid accessing registers in probe 2025-01-02 10:32:03 +01:00
at_hdmac.c
at_xdmac.c dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset 2025-01-02 10:32:03 +01:00
bcm-sba-raid.c
bcm2835-dma.c
dma-axi-dmac.c dmaengine: axi-dmac: fix possible race in remove() 2024-06-21 14:38:41 +02:00
dma-jz4780.c
dmaengine.c dmaengine: fix NULL pointer in channel unregistration function 2024-01-31 16:18:47 -08:00
dmaengine.h
dmatest.c dmaengine: Revert "dmaengine: dmatest: Fix dmatest waiting less when interrupted" 2025-05-22 14:12:19 +02:00
ep93xx_dma.c
fsl_raid.c
fsl_raid.h
fsl-edma-common.c dmaengine: fsl-edma: change the memory access from local into remote mode in i.MX 8QM 2024-08-11 12:47:17 +02:00
fsl-edma-common.h dmaengine: fsl-edma: implement the cleanup path of fsl_edma3_attach_pd() 2025-01-02 10:32:03 +01:00
fsl-edma-main.c dmaengine: fsl-edma: Fix return code for unhandled interrupts 2025-06-04 14:42:17 +02:00
fsl-qdma.c dmaengine: fsl-qdma: init irq after reg initialization 2024-03-06 14:48:41 +00:00
fsldma.c
fsldma.h
hisi_dma.c
idma64.c dmaengine: idma64: Add check for dma_set_max_seg_size 2024-06-12 11:12:15 +02:00
idma64.h
img-mdc-dma.c
imx-dma.c
imx-sdma.c
k3dma.c
Kconfig dmaengine: fsl-edma: avoid linking both modules 2024-06-27 13:49:09 +02:00
lpc18xx-dmamux.c
Makefile
mcf-edma-main.c
milbeaut-hdmac.c
milbeaut-xdmac.c
mmp_pdma.c
mmp_tdma.c
moxart-dma.c
mpc512x_dma.c
mv_xor_v2.c
mv_xor.c dmaengine: mv_xor: fix child node refcount handling in early exit 2025-01-02 10:32:02 +01:00
mv_xor.h
mxs-dma.c
nbpfaxi.c dmaengine: nbpfaxi: Fix memory corruption in probe() 2025-07-24 08:53:13 +02:00
of-dma.c
owl-dma.c dmaengine: owl: fix register access functions 2024-05-02 16:32:47 +02:00
pch_dma.c
pl330.c dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state" 2024-05-17 12:01:55 +02:00
plx_dma.c
pxa_dma.c
sa11x0-dma.c
sprd-dma.c
st_fdma.c
st_fdma.h
ste_dma40_ll.c
ste_dma40_ll.h
ste_dma40.c
ste_dma40.h
stm32-dma.c
stm32-dmamux.c
stm32-mdma.c
sun4i-dma.c
sun6i-dma.c
tegra20-apb-dma.c
tegra186-gpc-dma.c dmaengine: tegra: Return correct DMA status when paused 2025-01-02 10:32:02 +01:00
tegra210-adma.c
timb_dma.c
TODO
txx9dmac.c
txx9dmac.h
uniphier-mdmac.c
uniphier-xdmac.c
virt-dma.c
virt-dma.h
xgene-dma.c