From 87b919b2a2ec6059fe87f09f8d86a3f93cbd5442 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 7 Aug 2020 10:00:27 -0700 Subject: [PATCH] Revert "ANDROID: mnt: Fix null pointer dereference" This reverts commit cbfbd9e932dec85e9b30550b79d3b1ba040ce1d5 (change I6aedaa89536ae85e6bc29093f38934c672c8fe42). This is no longer needed because the only user of vfsmount::data was sdcardfs, and sdcardfs has now been removed. Bug: 157700134 Change-Id: I1f4da1a9e6ce1c3509fdf233cf9de446a53b28da Signed-off-by: Eric Biggers Signed-off-by: Greg Kroah-Hartman --- fs/namespace.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 54f8b6ce1c1d..79442c7a48e5 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -951,11 +951,9 @@ static struct mount *skip_mnt_tree(struct mount *p) struct vfsmount *vfs_create_mount(struct fs_context *fc) { struct mount *mnt; - struct super_block *sb; if (!fc->root) return ERR_PTR(-EINVAL); - sb = fc->root->d_sb; mnt = alloc_vfsmnt(fc->source ?: "none"); if (!mnt) @@ -968,8 +966,7 @@ struct vfsmount *vfs_create_mount(struct fs_context *fc) free_vfsmnt(mnt); return ERR_PTR(-ENOMEM); } - if (sb->s_op->update_mnt_data) - sb->s_op->update_mnt_data(mnt->mnt.data, fc); + fc->root->d_sb->s_op->update_mnt_data(mnt->mnt.data, fc); } if (fc->sb_flags & SB_KERNMOUNT) mnt->mnt.mnt_flags = MNT_INTERNAL; @@ -2632,7 +2629,7 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags, err = -EPERM; if (ns_capable(sb->s_user_ns, CAP_SYS_ADMIN)) { err = reconfigure_super(fc); - if (!err && sb->s_op->update_mnt_data) { + if (!err) { sb->s_op->update_mnt_data(mnt->mnt.data, fc); set_mount_attributes(mnt, mnt_flags); namespace_lock(); @@ -2640,8 +2637,7 @@ static int do_remount(struct path *path, int ms_flags, int sb_flags, propagate_remount(mnt); unlock_mount_hash(); namespace_unlock(); - } else if (!err) - set_mount_attributes(mnt, mnt_flags); + } } up_write(&sb->s_umount); }