linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: coh901318: Fix a double-lock bug
@ 2018-11-06  3:33 Jia-Ju Bai
  2018-11-14 13:36 ` Linus Walleij
  2018-11-24 14:30 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2018-11-06  3:33 UTC (permalink / raw)
  To: linus.walleij, vkoul, dan.j.williams
  Cc: linux-arm-kernel, dmaengine, linux-kernel, Jia-Ju Bai

The function coh901318_alloc_chan_resources() calls spin_lock_irqsave() 
before calling coh901318_config().
But coh901318_config() calls spin_lock_irqsave() again in its
definition, which may cause a double-lock bug.

Because coh901318_config() is only called by
coh901318_alloc_chan_resources(), the bug fix is to remove the
calls to spin-lock and -unlock functions in coh901318_config().

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/dma/coh901318.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index eebaba3d9e78..fd862a478738 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -1807,8 +1807,6 @@ static int coh901318_config(struct coh901318_chan *cohc,
 	int channel = cohc->id;
 	void __iomem *virtbase = cohc->base->virtbase;
 
-	spin_lock_irqsave(&cohc->lock, flags);
-
 	if (param)
 		p = param;
 	else
@@ -1828,8 +1826,6 @@ static int coh901318_config(struct coh901318_chan *cohc,
 	coh901318_set_conf(cohc, p->config);
 	coh901318_set_ctrl(cohc, p->ctrl_lli_last);
 
-	spin_unlock_irqrestore(&cohc->lock, flags);
-
 	return 0;
 }
 
-- 
2.17.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: coh901318: Fix a double-lock bug
  2018-11-06  3:33 [PATCH] dma: coh901318: Fix a double-lock bug Jia-Ju Bai
@ 2018-11-14 13:36 ` Linus Walleij
  2018-11-24 14:30 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-11-14 13:36 UTC (permalink / raw)
  To: baijiaju1990; +Cc: vkoul, Dan Williams, Linux ARM, dmaengine, linux-kernel

On Tue, Nov 6, 2018 at 4:33 AM Jia-Ju Bai <baijiaju1990@gmail.com> wrote:

> The function coh901318_alloc_chan_resources() calls spin_lock_irqsave()
> before calling coh901318_config().
> But coh901318_config() calls spin_lock_irqsave() again in its
> definition, which may cause a double-lock bug.
>
> Because coh901318_config() is only called by
> coh901318_alloc_chan_resources(), the bug fix is to remove the
> calls to spin-lock and -unlock functions in coh901318_config().
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dma: coh901318: Fix a double-lock bug
  2018-11-06  3:33 [PATCH] dma: coh901318: Fix a double-lock bug Jia-Ju Bai
  2018-11-14 13:36 ` Linus Walleij
@ 2018-11-24 14:30 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2018-11-24 14:30 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: linus.walleij, dan.j.williams, linux-arm-kernel, dmaengine, linux-kernel

On 06-11-18, 11:33, Jia-Ju Bai wrote:
> The function coh901318_alloc_chan_resources() calls spin_lock_irqsave() 
> before calling coh901318_config().
> But coh901318_config() calls spin_lock_irqsave() again in its
> definition, which may cause a double-lock bug.
> 
> Because coh901318_config() is only called by
> coh901318_alloc_chan_resources(), the bug fix is to remove the
> calls to spin-lock and -unlock functions in coh901318_config().

Applied after fixing subsystem tag, thanks
-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-24 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06  3:33 [PATCH] dma: coh901318: Fix a double-lock bug Jia-Ju Bai
2018-11-14 13:36 ` Linus Walleij
2018-11-24 14:30 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).