dmaengine: qcom-adm: fix wrong sizeof config in slave_config
Subsystems (3)
PATCH 1/1 dmaengine: qcom-adm: fix wrong sizeof config in slave_config
Fix broken slave_config function that uncorrectly compare the peripheral_size with the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver.
To fix this, compare to the size of the struct and NOT the size of the pointer.
--- drivers/dma/qcom/qcom_adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/qcom/qcom_adm.c +1 -1
@@ -494,7 +494,7 @@ static int adm_slave_config(struct dma_chan *chan, struct dma_slave_config *cfg)spin_lock_irqsave (&achan->vc.lock, flag);memcpy (&achan->slave, cfg,sizeof (struct dma_slave_config )); -if (cfg->peripheral_size ==sizeof (config)) +if (cfg->peripheral_size ==sizeof (*config)) achan->crci = config->crci;spin_unlock_irqrestore (&achan->vc.lock, flag);
Signature · 1 line
2.37.2
Quoted 6 lines · Christian Marangi
Fix broken
slave_configfunction that uncorrectly compare theperipheral_sizewith the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver.
Quoted 6 lines
To fix this, compare to the size of the struct and NOT the size of the pointer.
Fixes 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config")Signed-off-by Christian Marangi <[email protected]>Cc [email protected] # v5.17+
Quoted 3 lines
--- drivers/dma/qcom/qcom_adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
Quoted 11 lines · Christian Marangi
Fix broken
slave_configfunction that uncorrectly compare theperipheral_sizewith the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver.To fix this, compare to the size of the struct and NOT the size of the pointer.
Fixes 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config")Signed-off-by Christian Marangi <[email protected]>Cc [email protected] # v5.17+
Thanks for the fix,
I guess this worked on 64-bit by accident, since both the pointer and the struct are 8 bytes, but it was clearly wrong and broke 32-bit.
Arnd
Quoted 7 lines · Christian Marangi
Fix broken
slave_configfunction that uncorrectly compare theperipheral_sizewith the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver.To fix this, compare to the size of the struct and NOT the size of the pointer.
Applied, thanks
Signature · 1 line
~Vinod