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


Groups > linux.kernel > #1657251

[PATCH] ubifs: Fix a sleep-in-atomic bug in read_nnode

From Jia-Ju Bai <baijiaju1990@163.com>
Newsgroups linux.kernel
Subject [PATCH] ubifs: Fix a sleep-in-atomic bug in read_nnode
Date 2017-06-05 05:50 +0200
Message-ID <tORbI-5WD-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The driver may sleep under a spin lock, and the function call path is:
ubifs_change_lp (acquire the lock by spin_lock)
  change_category
    ubifs_remove_from_cat
      remove_from_lpt_heap
        dbg_check_heap
          ubifs_lpt_lookup
            ubifs_get_pnode
              read_pnode
                kzalloc(GFP_NOFS) --> may sleep

To fix it, "GFP_NOFS" is replaced with "GFP_ATOMIC".

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

diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index 9a51710..fabe2fd 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -1268,7 +1268,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
 	branch = &parent->nbranch[iip];
 	lnum = branch->lnum;
 	offs = branch->offs;
-	pnode = kzalloc(sizeof(struct ubifs_pnode), GFP_NOFS);
+	pnode = kzalloc(sizeof(struct ubifs_pnode), GFP_ATOMIC);
 	if (!pnode)
 		return -ENOMEM;
 
-- 
1.7.9.5

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] ubifs: Fix a sleep-in-atomic bug in read_nnode Jia-Ju Bai <baijiaju1990@163.com> - 2017-06-05 05:50 +0200

csiph-web