linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held
@ 2016-01-24  6:54 Saurabh Sengar
  2016-01-26  0:52 ` Scott Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Saurabh Sengar @ 2016-01-24  6:54 UTC (permalink / raw)
  To: scottwood, qiang.zhao, christophe.leroy, linuxppc-dev, linux-kernel
  Cc: Saurabh Sengar

cpm_muram_alloc_common is called twice and both the times
spin_lock_irqsave is held.
Using GFP_KERNEL can sleep in spin_lock_irqsave context and cause
deadlock

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
Let me know if there is any other way to fix it.
Also, I would say this function should be static as it is not used in any other file
 drivers/soc/fsl/qe/qe_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
index 419fa5b..d774e54 100644
--- a/drivers/soc/fsl/qe/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -194,7 +194,7 @@ unsigned long cpm_muram_alloc_common(unsigned long size, genpool_algo_t algo,
 		goto out2;
 	start = start - GENPOOL_OFFSET;
 	memset_io(cpm_muram_addr(start), 0, size);
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+	entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
 	if (!entry)
 		goto out1;
 	entry->start = start;
-- 
1.9.1

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

* Re: [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held
  2016-01-24  6:54 [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held Saurabh Sengar
@ 2016-01-26  0:52 ` Scott Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2016-01-26  0:52 UTC (permalink / raw)
  To: Saurabh Sengar, qiang.zhao, christophe.leroy, linuxppc-dev, linux-kernel

On Sun, 2016-01-24 at 12:24 +0530, Saurabh Sengar wrote:
> cpm_muram_alloc_common is called twice and both the times
> spin_lock_irqsave is held.
> Using GFP_KERNEL can sleep in spin_lock_irqsave context and cause
> deadlock
> 
> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> Let me know if there is any other way to fix it.
> Also, I would say this function should be static as it is not used in any
> other file
>  drivers/soc/fsl/qe/qe_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Yes, it should be static.  Do you plan to send a patch for that?

-Scott

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

end of thread, other threads:[~2016-01-26  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24  6:54 [PATCH] QE: Use GFP_ATOMIC while spin_lock_irqsave is held Saurabh Sengar
2016-01-26  0:52 ` Scott Wood

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).