aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2017-09-06 13:06:43 -0700
committerMister Oyster <oysterized@gmail.com>2017-09-13 12:02:12 +0200
commitb3ed3de99abb5bb788e64ea675f971b05fae80b0 (patch)
treed471bb43923e132aef7d960ed10d93b18b48936e /fs
parentb5b2ee6239c9fc4618af32caac3361f04612e821 (diff)
ANDROID: mnt: Fix freeing of mount data
Fix double free on error paths Signed-off-by: Daniel Rosenberg <drosen@google.com> Change-Id: I1c25a175e87e5dd5cafcdcf9d78bf4c0dc3f88ef Bug: 65386954 Fixes: aa6d3ace42f9 ("mnt: Add filesystem private data to mount points")
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index e3842b535..aeee6d5e2 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -318,6 +318,7 @@ static struct mount *alloc_vfsmnt(const char *name)
mnt->mnt_count = 1;
mnt->mnt_writers = 0;
#endif
+ mnt->mnt.data = NULL;
INIT_LIST_HEAD(&mnt->mnt_hash);
INIT_LIST_HEAD(&mnt->mnt_child);
@@ -915,7 +916,6 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
if (!mnt)
return ERR_PTR(-ENOMEM);
- mnt->mnt.data = NULL;
if (type->alloc_mnt_data) {
mnt->mnt.data = type->alloc_mnt_data();
if (!mnt->mnt.data) {
@@ -929,7 +929,6 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
root = mount_fs(type, flags, name, &mnt->mnt, data);
if (IS_ERR(root)) {
- kfree(mnt->mnt.data);
free_vfsmnt(mnt);
return ERR_CAST(root);
}
@@ -1027,7 +1026,6 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
return mnt;
out_free:
- kfree(mnt->mnt.data);
free_vfsmnt(mnt);
return ERR_PTR(err);
}