All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] isdn: Fix a sleep-in-atomic bug
@ 2017-05-31  1:40 Jia-Ju Bai
  2017-05-31 18:38 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2017-05-31  1:40 UTC (permalink / raw)
  To: isdn, davem, geliangtang, keescook; +Cc: netdev, linux-kernel, Jia-Ju Bai

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

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

* Re: [PATCH] isdn: Fix a sleep-in-atomic bug
  2017-05-31  1:40 [PATCH] isdn: Fix a sleep-in-atomic bug Jia-Ju Bai
@ 2017-05-31 18:38 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-05-31 18:38 UTC (permalink / raw)
  To: baijiaju1990; +Cc: isdn, geliangtang, keescook, netdev, linux-kernel

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.

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

end of thread, other threads:[~2017-05-31 18:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31  1:40 [PATCH] isdn: Fix a sleep-in-atomic bug Jia-Ju Bai
2017-05-31 18:38 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.