* [PATCH v3] mmc: mxs: Initialize the spinlock prior to using it
@ 2016-11-05 19:45 Fabio Estevam
2016-11-07 12:43 ` Ulf Hansson
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2016-11-05 19:45 UTC (permalink / raw)
To: ulf.hansson; +Cc: kernel, marex, stefan.wahren, linux-mmc, Fabio Estevam
From: Fabio Estevam <fabio.estevam@nxp.com>
An interrupt may occur right after devm_request_irq() is called and
prior to the spinlock initialization, leading to a kernel oops,
as the interrupt handler uses the spinlock.
In order to prevent this problem, move the spinlock initialization
prior to requesting the interrupts.
Fixes: e4243f13d10e (mmc: mxs-mmc: add mmc host driver for i.MX23/28)
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
Changes since v2:
- Add a Fixes tag as suggested by Stefan
Changes since v1:
- Make it a standalone patch instead of patch series
- Cc stable as suggested by Stefan
drivers/mmc/host/mxs-mmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index d839147..44ecebd 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -661,13 +661,13 @@ static int mxs_mmc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mmc);
+ spin_lock_init(&host->lock);
+
ret = devm_request_irq(&pdev->dev, irq_err, mxs_mmc_irq_handler, 0,
dev_name(&pdev->dev), host);
if (ret)
goto out_free_dma;
- spin_lock_init(&host->lock);
-
ret = mmc_add_host(mmc);
if (ret)
goto out_free_dma;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] mmc: mxs: Initialize the spinlock prior to using it
2016-11-05 19:45 [PATCH v3] mmc: mxs: Initialize the spinlock prior to using it Fabio Estevam
@ 2016-11-07 12:43 ` Ulf Hansson
0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2016-11-07 12:43 UTC (permalink / raw)
To: Fabio Estevam
Cc: Sascha Hauer, Marek Vašut, Stefan Wahren, linux-mmc,
Fabio Estevam
On 5 November 2016 at 20:45, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> An interrupt may occur right after devm_request_irq() is called and
> prior to the spinlock initialization, leading to a kernel oops,
> as the interrupt handler uses the spinlock.
>
> In order to prevent this problem, move the spinlock initialization
> prior to requesting the interrupts.
>
> Fixes: e4243f13d10e (mmc: mxs-mmc: add mmc host driver for i.MX23/28)
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> Reviewed-by: Marek Vasut <marex@denx.de>
Thanks, applied for fixes!
Kind regards
Uffe
> ---
> Changes since v2:
> - Add a Fixes tag as suggested by Stefan
> Changes since v1:
> - Make it a standalone patch instead of patch series
> - Cc stable as suggested by Stefan
>
> drivers/mmc/host/mxs-mmc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> index d839147..44ecebd 100644
> --- a/drivers/mmc/host/mxs-mmc.c
> +++ b/drivers/mmc/host/mxs-mmc.c
> @@ -661,13 +661,13 @@ static int mxs_mmc_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, mmc);
>
> + spin_lock_init(&host->lock);
> +
> ret = devm_request_irq(&pdev->dev, irq_err, mxs_mmc_irq_handler, 0,
> dev_name(&pdev->dev), host);
> if (ret)
> goto out_free_dma;
>
> - spin_lock_init(&host->lock);
> -
> ret = mmc_add_host(mmc);
> if (ret)
> goto out_free_dma;
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-07 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-05 19:45 [PATCH v3] mmc: mxs: Initialize the spinlock prior to using it Fabio Estevam
2016-11-07 12:43 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox