[PATCH 4/4] hypfs: free sb->s_fs_info after shutting down the super block

Christoph Hellwig
2023-08-31T05:32:50Z

sb->s_fs_info can only be safely freed after generic_shutdown_super was
called and all access to the super_block has stopped.

Thus only free the private data after calling kill_litter_super, which
calls generic_shutdown_super internally.

Also remove the pointless clearing of sb->s_fs_info as the super_block
can't be accessed at this point and will be freed immediately.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/s390/hypfs/inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index ada83149932fec..dbe8a7dcafa922 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -329,9 +329,8 @@ static void hypfs_kill_super(struct super_block *sb)
hypfs_delete_tree(sb->s_root);
if (sb_info && sb_info->update_file)
hypfs_remove(sb_info->update_file);
- kfree(sb->s_fs_info);
- sb->s_fs_info = NULL;
kill_litter_super(sb);
+ kfree(sb->s_fs_info);
}

static struct dentry *hypfs_create_file(struct dentry *parent, const char *name,
--
2.39.2