linux/fs/ocfs2/cluster
Chengfeng Ye 84c10951da ocfs2: cluster: fix potential deadlock on &o2net_debug_lock
&o2net_debug_lock is acquired by timer o2net_idle_timer() along the
following call chain.  Thus the acquisition of the lock under process
context should disable bottom half, otherwise deadlock could happen if the
timer happens to preempt the execution while the lock is held in process
context on the same CPU.

<timer interrupt>
        -> o2net_idle_timer()
        -> queue_delayed_work()
        -> sc_put()
        -> sc_kref_release()
        -> o2net_debug_del_sc()
        -> spin_lock(&o2net_debug_lock);

Several lock acquisition of &o2net_debug_lock under process context do not
disable irq or bottom half.  The patch fixes these potential deadlocks
scenerio by using spin_lock_bh() on &o2net_debug_lock.

This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock.  x86_64 allmodconfig using gcc shows
no new warning.

Link: https://lkml.kernel.org/r/20230802131436.17765-1-dg573847474@gmail.com
Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
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: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-08-18 10:18:59 -07:00
..
heartbeat.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
heartbeat.h ocfs2: use bitmap API in fill_node_map 2022-11-18 13:55:06 -08:00
Makefile
masklog.c ocfs2: cluster: use default_groups in kobj_type 2022-01-15 16:30:24 +02:00
masklog.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
netdebug.c ocfs2: cluster: fix potential deadlock on &o2net_debug_lock 2023-08-18 10:18:59 -07:00
nodemanager.c ocfs2/cluster: use bitmap API instead of hand-writing it 2022-11-18 13:55:06 -08:00
nodemanager.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_heartbeat.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_nodemanager.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
quorum.c ocfs2: cluster: fix potential deadlock on &qs->qs_lock 2023-08-18 10:18:59 -07:00
quorum.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
sys.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
sys.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
tcp_internal.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
tcp.c ocfs2: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage() 2023-06-24 15:50:13 -07:00
tcp.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00