mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
ocfs2: fix crash when initialize filecheck kobj fails
commit7b0b1332cfupstream. Once s_root is set, genric_shutdown_super() will be called if fill_super() fails. That means, we will call ocfs2_dismount_volume() twice in such case, which can lead to kernel crash. Fix this issue by initializing filecheck kobj before setting s_root. Link: https://lkml.kernel.org/r/20220310081930.86305-1-joseph.qi@linux.alibaba.com Fixes:5f483c4abb("ocfs2: add kobject for online file check") Signed-off-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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0f9b7b8df1
commit
df3301dc60
@@ -1110,17 +1110,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
goto read_super_error;
|
goto read_super_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
root = d_make_root(inode);
|
|
||||||
if (!root) {
|
|
||||||
status = -ENOMEM;
|
|
||||||
mlog_errno(status);
|
|
||||||
goto read_super_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
sb->s_root = root;
|
|
||||||
|
|
||||||
ocfs2_complete_mount_recovery(osb);
|
|
||||||
|
|
||||||
osb->osb_dev_kset = kset_create_and_add(sb->s_id, NULL,
|
osb->osb_dev_kset = kset_create_and_add(sb->s_id, NULL,
|
||||||
&ocfs2_kset->kobj);
|
&ocfs2_kset->kobj);
|
||||||
if (!osb->osb_dev_kset) {
|
if (!osb->osb_dev_kset) {
|
||||||
@@ -1138,6 +1127,17 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
goto read_super_error;
|
goto read_super_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root = d_make_root(inode);
|
||||||
|
if (!root) {
|
||||||
|
status = -ENOMEM;
|
||||||
|
mlog_errno(status);
|
||||||
|
goto read_super_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
sb->s_root = root;
|
||||||
|
|
||||||
|
ocfs2_complete_mount_recovery(osb);
|
||||||
|
|
||||||
if (ocfs2_mount_local(osb))
|
if (ocfs2_mount_local(osb))
|
||||||
snprintf(nodestr, sizeof(nodestr), "local");
|
snprintf(nodestr, sizeof(nodestr), "local");
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user