mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
dmaengine: ste_dma40: Validate fixed physical channel indexes
Fixed physical memcpy allocation uses dma_cfg.phy_channel directly as an
index into phy_res when use_fixed_channel is set. d40_validate_conf()
validates dev_type but not the fixed physical channel, allowing an invalid
configuration to access memory outside the array.
Validate the fixed physical channel centrally before accepting the channel
configuration.
Fixes: f000df8c5a ("dmaengine: ste_dma40: support fixed physical channel allocation")
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/dmaengine/20260819225008.5F9651F000E9@smtp.kernel.org/
Assisted-by: LLM
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260927-dma40-fixes-v7-23-89f595e8851d@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
b36f8fce73
commit
884e01160b
|
|
@ -1911,6 +1911,14 @@ static int d40_validate_conf(struct d40_chan *d40c,
|
|||
res = -EINVAL;
|
||||
}
|
||||
|
||||
if (conf->use_fixed_channel &&
|
||||
(conf->phy_channel < 0 ||
|
||||
conf->phy_channel >= d40c->base->num_phy_chans)) {
|
||||
chan_err(d40c, "Invalid physical channel (%d)\n",
|
||||
conf->phy_channel);
|
||||
res = -EINVAL;
|
||||
}
|
||||
|
||||
if (conf->dir == DMA_DEV_TO_DEV) {
|
||||
/*
|
||||
* DMAC HW supports it. Will be added to this driver,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user