[PATCH 1/6] vfs: Fix vfs_dup_fs_context()

From: David Howells
Date: Tue Aug 21 2018 - 05:55:10 EST


vfs_dup_fs_context() allocates the wrong type of structure and as a result
ends up with one that's too small.

This isn't a problem at this time as nothing uses vfs_dup_fs_context() yet
(until nfs and btrfs conversions come along).

Fixes: ad3e21240b41 ("vfs: Implement a filesystem superblock creation/configuration context")
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

fs/fs_context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs_context.c b/fs/fs_context.c
index a6597a2fbf2b..14921b2c1e42 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -348,7 +348,7 @@ struct fs_context *vfs_dup_fs_context(struct fs_context *src_fc)
if (!src_fc->ops->dup)
return ERR_PTR(-EOPNOTSUPP);

- fc = kmemdup(src_fc, sizeof(struct legacy_fs_context), GFP_KERNEL);
+ fc = kmemdup(src_fc, sizeof(struct fs_context), GFP_KERNEL);
if (!fc)
return ERR_PTR(-ENOMEM);