]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 15 May 2023 10:32:10 +0000 (13:32 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 4 Sep 2023 09:10:21 +0000 (11:10 +0200)
commitefaa1f435e018a6d124b0abb5efa9960cf48faed
tree267a3dc21e02394860c5541b39f2b79243a4f5b8
parent2f959729233aca1de9eb2bea41e5afec3a67f5a8
dmaengine: at_xdmac: fix potential Oops in at_xdmac_prep_interleaved()

BugLink: https://bugs.launchpad.net/bugs/2029808
[ Upstream commit 4d43acb145c363626d76f49febb4240c488cd1cf ]

There are two place if the at_xdmac_interleaved_queue_desc() fails which
could lead to a NULL dereference where "first" is NULL and we call
list_add_tail(&first->desc_node, ...).  In the first caller, the return
is not checked so add a check for that.  In the next caller, the return
is checked but if it fails on the first iteration through the loop then
it will lead to a NULL pointer dereference.

Fixes: 4e5385784e69 ("dmaengine: at_xdmac: handle numf > 1")
Fixes: 62b5cb757f1d ("dmaengine: at_xdmac: fix memory leak in interleaved mode")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/r/21282b66-9860-410a-83df-39c17fcf2f1b@kili.mountain
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/dma/at_xdmac.c