efivarfs: Defer PM notifier registration until .fill_super
syzbot reports an issue that turns out to be caused by the fact that the efivarfs PM notifier may be invoked before the efivarfs_fs_info::sb field is populated, resulting in a NULL deference. So defer the registration until efivarfs_fill_super() is invoked. Reported-by: syzbot+00d13e505ef530a45100@syzkaller.appspotmail.com Tested-by: syzbot+00d13e505ef530a45100@syzkaller.appspotmail.com Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
d6a2d02aa0
commit
cb6ae457bc
1 changed files with 2 additions and 1 deletions
|
@ -367,6 +367,8 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
register_pm_notifier(&sfi->pm_nb);
|
||||||
|
|
||||||
return efivar_init(efivarfs_callback, sb, true);
|
return efivar_init(efivarfs_callback, sb, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +554,6 @@ static int efivarfs_init_fs_context(struct fs_context *fc)
|
||||||
|
|
||||||
sfi->pm_nb.notifier_call = efivarfs_pm_notify;
|
sfi->pm_nb.notifier_call = efivarfs_pm_notify;
|
||||||
sfi->pm_nb.priority = 0;
|
sfi->pm_nb.priority = 0;
|
||||||
register_pm_notifier(&sfi->pm_nb);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue