1
0
Fork 0
alistair23-linux/fs/ocfs2/dlm
Jia-Ju Bai 999865764f fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle()
The kernel module may sleep with holding a spinlock.

The function call paths (from bottom to top) in Linux-4.16 are:

[FUNC] get_zeroed_page(GFP_NOFS)
fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle
fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle
fs/ocfs2/dlm/dlmmaster.c, 255: __dlm_put_mle in dlm_put_mle
fs/ocfs2/dlm/dlmmaster.c, 254: spin_lock in dlm_put_ml

[FUNC] get_zeroed_page(GFP_NOFS)
fs/ocfs2/dlm/dlmdebug.c, 332: get_zeroed_page in dlm_print_one_mle
fs/ocfs2/dlm/dlmmaster.c, 240: dlm_print_one_mle in __dlm_put_mle
fs/ocfs2/dlm/dlmmaster.c, 222: __dlm_put_mle in dlm_put_mle_inuse
fs/ocfs2/dlm/dlmmaster.c, 219: spin_lock in dlm_put_mle_inuse

To fix this bug, GFP_NOFS is replaced with GFP_ATOMIC.

This bug is found by my static analysis tool DSAC.

Link: http://lkml.kernel.org/r/20180901112528.27025-1-baijiaju1990@gmail.com
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-26 16:25:18 -07:00
..
Makefile ocfs2: remove versioning information 2014-01-21 16:19:41 -08:00
dlmapi.h ocfs2/trivial: Remove trailing whitespaces 2010-01-25 19:20:51 -08:00
dlmast.c ocfs2/dlm: clean up unused stack variable in dlm_do_local_ast() 2018-04-05 21:36:22 -07:00
dlmcommon.h ocfs2/dlm: wait for dlm recovery done when migrating all lock resources 2018-04-05 21:36:22 -07:00
dlmconvert.c ocfs2/dlm: fix race between convert and migration 2016-09-19 15:36:16 -07:00
dlmconvert.h [PATCH] OCFS2: The Second Oracle Cluster Filesystem 2006-01-03 11:45:47 -08:00
dlmdebug.c fs/ocfs2/dlm/dlmdebug.c: fix a sleep-in-atomic-context bug in dlm_print_one_mle() 2018-10-26 16:25:18 -07:00
dlmdebug.h ocfs2/dlm: fix memory leak of dlm_debug_ctxt 2016-07-26 16:19:19 -07:00
dlmdomain.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
dlmdomain.h ocfs2/dlm: don't handle migrate lockres if already in shutdown 2018-04-05 21:36:22 -07:00
dlmlock.c ocfs2: remove unnecessary null pointer check before kmem_cache_destroy() 2018-04-05 21:36:22 -07:00
dlmmaster.c ocfs2: fix locking for res->tracking and dlm->tracking_list 2018-10-05 16:32:05 -07:00
dlmrecovery.c ocfs2/dlm: clean up unused variable in dlm_process_recovery_data 2018-04-05 21:36:22 -07:00
dlmthread.c ocfs2/dlm: remove unnecessary parentheses 2018-10-26 16:25:18 -07:00
dlmunlock.c locking/atomic, kref: Add kref_read() 2017-01-14 11:37:18 +01:00