diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2025-02-23 16:48:54 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2025-02-23 17:30:05 +0100 |
commit | cb6ae457bc6af58c84a7854df5e7e32ba1c6a715 (patch) | |
tree | 4348c0f72a99ba5f455edb6a89fa733517c9b568 | |
parent | d6a2d02aa060531607f4a8411ec384470faa2761 (diff) |
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>
-rw-r--r-- | fs/efivarfs/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 09fcf731e65d..6eae8cf655c1 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -367,6 +367,8 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc) if (err) return err; + register_pm_notifier(&sfi->pm_nb); + 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.priority = 0; - register_pm_notifier(&sfi->pm_nb); return 0; } |