dmaengine: ti: k3-udma: Set r/tchan or rflow to NULL if request fail
authorKishon Vijay Abraham I <kishon@ti.com>
Sun, 31 Oct 2021 03:24:11 +0000 (08:54 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:16 +0000 (19:17 +0100)
commitc4cd9e5acc34735e344b0cc03a8f27cc0b4fa0b3
treeea5d4a90539598c3a4fd9bdff8063fc3d8e9c9aa
parent68ae6ae1431f0fb6af514b97aec0792e61c55d34
dmaengine: ti: k3-udma: Set r/tchan or rflow to NULL if request fail

commit eb91224e47ec33a0a32c9be0ec0fcb3433e555fd upstream.

udma_get_*() checks if rchan/tchan/rflow is already allocated by checking
if it has a NON NULL value. For the error cases, rchan/tchan/rflow will
have error value 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 rchan/tchan/rflow.

Reset the value of rchan/tchan/rflow to NULL if a channel request fails.

CC: stable@vger.kernel.org
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Link: https://lore.kernel.org/r/20211031032411.27235-3-kishon@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma/ti/k3-udma.c