super: move lockdep assert

Fix braino and move the lockdep assertion after put_super() otherwise we
risk a use-after-free.

Fixes: 2c18a63b76 ("super: wait until we passed kill super")
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Message-Id: <20230828-vfs-super-fixes-v1-1-b37a4a04a88f@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner 2023-08-28 13:26:23 +02:00
parent cd4284cfd3
commit 345a5c4a0b
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -570,8 +570,8 @@ static bool grab_super_dead(struct super_block *sb)
return true; return true;
} }
wait_var_event(&sb->s_flags, wait_dead(sb)); wait_var_event(&sb->s_flags, wait_dead(sb));
put_super(sb);
lockdep_assert_not_held(&sb->s_umount); lockdep_assert_not_held(&sb->s_umount);
put_super(sb);
return false; return false;
} }