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


Groups > linux.kernel > #1653764 > unrolled thread

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

Started byJia-Ju Bai <baijiaju1990@163.com>
First post2017-05-31 03:40 +0200
Last post2017-05-31 20:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] isdn: Fix a sleep-in-atomic bug Jia-Ju Bai <baijiaju1990@163.com> - 2017-05-31 03:40 +0200
    Re: [PATCH] isdn: Fix a sleep-in-atomic bug David Miller <davem@davemloft.net> - 2017-05-31 20:40 +0200

#1653764 — [PATCH] isdn: Fix a sleep-in-atomic bug

FromJia-Ju Bai <baijiaju1990@163.com>
Date2017-05-31 03:40 +0200
Subject[PATCH] isdn: Fix a sleep-in-atomic bug
Message-ID<tN0M9-6u9-3@gated-at.bofh.it>
The driver may sleep under a spin lock, the function call path is:
isdn_ppp_mp_receive (acquire the lock)
  isdn_ppp_mp_reassembly
    isdn_ppp_push_higher
      isdn_ppp_decompress
        isdn_ppp_ccp_reset_trans
          isdn_ppp_ccp_reset_alloc_state
            kzalloc(GFP_KERNEL) --> may sleep

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

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

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index d07dd519..8aa158a 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -2364,7 +2364,7 @@ static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_s
 		       id);
 		return NULL;
 	} else {
-		rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL);
+		rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_ATOMIC);
 		if (!rs)
 			return NULL;
 		rs->state = CCPResetIdle;
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1654540

FromDavid Miller <davem@davemloft.net>
Date2017-05-31 20:40 +0200
Message-ID<tNgHf-8pT-13@gated-at.bofh.it>
In reply to#1653764
From: Jia-Ju Bai <baijiaju1990@163.com>
Date: Wed, 31 May 2017 09:40:11 +0800

> The driver may sleep under a spin lock, the function call path is:
> isdn_ppp_mp_receive (acquire the lock)
>   isdn_ppp_mp_reassembly
>     isdn_ppp_push_higher
>       isdn_ppp_decompress
>         isdn_ppp_ccp_reset_trans
>           isdn_ppp_ccp_reset_alloc_state
>             kzalloc(GFP_KERNEL) --> may sleep
> 
> To fixed it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web