Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653891 > unrolled thread

[PATCH] mISDN: Fix a sleep-in-atomic bug

Started byJia-Ju Bai <baijiaju1990@163.com>
First post2017-05-31 09:10 +0200
Last post2017-06-01 21:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mISDN: Fix a sleep-in-atomic bug Jia-Ju Bai <baijiaju1990@163.com> - 2017-05-31 09:10 +0200
    Re: [PATCH] mISDN: Fix a sleep-in-atomic bug David Miller <davem@davemloft.net> - 2017-06-01 21:00 +0200

#1653891 — [PATCH] mISDN: Fix a sleep-in-atomic bug

FromJia-Ju Bai <baijiaju1990@163.com>
Date2017-05-31 09:10 +0200
Subject[PATCH] mISDN: Fix a sleep-in-atomic bug
Message-ID<tN5Vv-1DA-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1655677

FromDavid Miller <davem@davemloft.net>
Date2017-06-01 21:00 +0200
Message-ID<tNDua-6m6-17@gated-at.bofh.it>
In reply to#1653891
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web