* [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config
@ 2022-09-15 20:48 Christian Marangi
2022-09-15 21:56 ` Dmitry Baryshkov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christian Marangi @ 2022-09-15 20:48 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Mark Brown, Arnd Bergmann, linux-arm-msm, dmaengine,
linux-kernel
Cc: Christian Marangi, stable
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.
Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org # v5.17+
---
drivers/dma/qcom/qcom_adm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c
index facdacf8aede..c77d9de853de 100644
--- a/drivers/dma/qcom/qcom_adm.c
+++ b/drivers/dma/qcom/qcom_adm.c
@@ -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);
--
2.37.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config
2022-09-15 20:48 [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Christian Marangi
@ 2022-09-15 21:56 ` Dmitry Baryshkov
2022-09-16 12:20 ` Arnd Bergmann
2022-09-29 16:43 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2022-09-15 21:56 UTC (permalink / raw)
To: Christian Marangi
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Mark Brown, Arnd Bergmann, linux-arm-msm, dmaengine,
linux-kernel, stable
On Thu, 15 Sept 2022 at 23:49, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> 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.
>
> Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config")
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Cc: stable@vger.kernel.org # v5.17+
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/dma/qcom/qcom_adm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config
2022-09-15 20:48 [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Christian Marangi
2022-09-15 21:56 ` Dmitry Baryshkov
@ 2022-09-16 12:20 ` Arnd Bergmann
2022-09-29 16:43 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2022-09-16 12:20 UTC (permalink / raw)
To: Christian Marangi, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Vinod Koul, Mark Brown, linux-arm-msm, dmaengine, linux-kernel
Cc: stable
On Thu, Sep 15, 2022, at 10:48 PM, Christian Marangi wrote:
> 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.
>
> Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config")
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Cc: stable@vger.kernel.org # v5.17+
Thanks for the fix,
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config
2022-09-15 20:48 [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Christian Marangi
2022-09-15 21:56 ` Dmitry Baryshkov
2022-09-16 12:20 ` Arnd Bergmann
@ 2022-09-29 16:43 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2022-09-29 16:43 UTC (permalink / raw)
To: Christian Marangi
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Mark Brown,
Arnd Bergmann, linux-arm-msm, dmaengine, linux-kernel, stable
On 15-09-22, 22:48, Christian Marangi wrote:
> 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.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-29 16:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 20:48 [PATCH] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Christian Marangi
2022-09-15 21:56 ` Dmitry Baryshkov
2022-09-16 12:20 ` Arnd Bergmann
2022-09-29 16:43 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.