OSDN Git Service

ocfs2: fix freeing uninitialized resource on ocfs2_dlm_shutdown
authorHeming Zhao <ocfs2-devel@oss.oracle.com>
Mon, 15 Aug 2022 08:57:54 +0000 (16:57 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 28 Aug 2022 21:02:45 +0000 (14:02 -0700)
commit550842cc60987b269e31b222283ade3e1b6c7fc8
tree1a7201c7b99472a8fa35ce421f133304eac4eb18
parentdbb16df6443c59e8a1ef21c2272fcf387d600ddf
ocfs2: fix freeing uninitialized resource on ocfs2_dlm_shutdown

After commit 0737e01de9c4 ("ocfs2: ocfs2_mount_volume does cleanup job
before return error"), any procedure after ocfs2_dlm_init() fails will
trigger crash when calling ocfs2_dlm_shutdown().

ie: On local mount mode, no dlm resource is initialized.  If
ocfs2_mount_volume() fails in ocfs2_find_slot(), error handling will call
ocfs2_dlm_shutdown(), then does dlm resource cleanup job, which will
trigger kernel crash.

This solution should bypass uninitialized resources in
ocfs2_dlm_shutdown().

Link: https://lkml.kernel.org/r/20220815085754.20417-1-heming.zhao@suse.com
Fixes: 0737e01de9c4 ("ocfs2: ocfs2_mount_volume does cleanup job before return error")
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/dlmglue.c
fs/ocfs2/super.c