netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mISDN: Fix a sleep-in-atomic bug
@ 2017-05-31  7:08 Jia-Ju Bai
  2017-06-01 18:50 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-05-31  7:08 UTC (permalink / raw)
  To: isdn, mingo, fweisbec, geliangtang, akpm, davem, yamada.masahiro
  Cc: netdev, linux-kernel, Jia-Ju Bai

The driver may sleep under a read spin lock, and the function call path is:
send_socklist (acquire the lock by read_lock)
  skb_copy(GFP_KERNEL) --> may sleep

To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/isdn/mISDN/stack.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c
index 8b7faea..422dced 100644
--- a/drivers/isdn/mISDN/stack.c
+++ b/drivers/isdn/mISDN/stack.c
@@ -75,7 +75,7 @@
 		if (sk->sk_state != MISDN_BOUND)
 			continue;
 		if (!cskb)
-			cskb = skb_copy(skb, GFP_KERNEL);
+			cskb = skb_copy(skb, GFP_ATOMIC);
 		if (!cskb) {
 			printk(KERN_WARNING "%s no skb\n", __func__);
 			break;
-- 
1.7.9.5

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

* Re: [PATCH] mISDN: Fix a sleep-in-atomic bug
  2017-05-31  7:08 [PATCH] mISDN: Fix a sleep-in-atomic bug Jia-Ju Bai
@ 2017-06-01 18:50 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-06-01 18:50 UTC (permalink / raw)
  To: baijiaju1990
  Cc: isdn, mingo, fweisbec, geliangtang, akpm, yamada.masahiro, netdev,
	linux-kernel

From: Jia-Ju Bai <baijiaju1990@163.com>
Date: Wed, 31 May 2017 15:08:25 +0800

> The driver may sleep under a read spin lock, and the function call path is:
> send_socklist (acquire the lock by read_lock)
>   skb_copy(GFP_KERNEL) --> may sleep
> 
> To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>

Just proves that nobody has ever run this code with lock debugging
enabled, if at all.

Applied, thanks.

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

end of thread, other threads:[~2017-06-01 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-31  7:08 [PATCH] mISDN: Fix a sleep-in-atomic bug Jia-Ju Bai
2017-06-01 18:50 ` David Miller

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