]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commit
dmaengine: ti: k3-udma: Fix NULL pointer dereference error
authorKishon Vijay Abraham I <kishon@ti.com>
Tue, 9 Feb 2021 12:26:32 +0000 (17:56 +0530)
committerDave Gerlach <d-gerlach@ti.com>
Thu, 11 Feb 2021 03:12:27 +0000 (21:12 -0600)
commitda3c66f551423e960049fd66ae907c5909352d8f
tree1e205fc5deffcd8fe71317f5f9a32c4df7c7397c
parenta9d93b268c111bcb868e9405bfab0431a419b253
dmaengine: ti: k3-udma: Fix NULL pointer dereference error

bcdma_get_*() and udma_get_*() checks if bchan/rchan/tchan/rflow is
already allocated by checking if it has a NON NULL value. For the
error cases, bchan/rchan/tchan/rflow will have error value
and bcdma_get_*() and udma_get_*() considers this as already allocated
(PASS) since the error values are NON NULL. This results in
NULL pointer dereference error while de-referencing
bchan/rchan/tchan/rflow.

Reset the value of bchan/rchan/tchan/rflow to NULL if the allocation
actually fails.

Fixes: 017794739702 ("dmaengine: ti: k3-udma: Initial support for K3 BCDMA")
Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/dma/ti/k3-udma.c