From: Greg Kroah-Hartman Date: Tue, 11 Feb 2025 08:31:12 +0000 (+0100) Subject: 6.6-stable patches X-Git-Tag: v6.6.77~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3f98cfcf29cfb7daf371cd8050329a456c3d4318;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: revert-hostfs-add-const-qualifier-to-host_root-in-hostfs_fill_super.patch revert-hostfs-convert-hostfs-to-use-the-new-mount-api.patch revert-hostfs-fix-string-handling-in-__dentry_name.patch revert-hostfs-fix-the-host-directory-parse-when-mounting.patch --- diff --git a/queue-6.6/revert-hostfs-add-const-qualifier-to-host_root-in-hostfs_fill_super.patch b/queue-6.6/revert-hostfs-add-const-qualifier-to-host_root-in-hostfs_fill_super.patch new file mode 100644 index 0000000000..21db9b61d8 --- /dev/null +++ b/queue-6.6/revert-hostfs-add-const-qualifier-to-host_root-in-hostfs_fill_super.patch @@ -0,0 +1,38 @@ +From 8c8c82e65815a40a4560fd74eecf2ca42c3d1a3b Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 11 Feb 2025 09:20:44 +0100 +Subject: Revert "hostfs: Add const qualifier to host_root in hostfs_fill_super()" + +From: Greg Kroah-Hartman + +This reverts commit 1fbe93dd7e6a0dab59a5fce99f16703f7d52ed81 which is +commit 104eef133fd9c17e4dc28bf43f592a86f26d8a59 upstream. + +It is reported to cause build issues and odds are the root problem isn't +really an issue on the 6.6.y branch anyway. If it is, someone can +provide a working set of backported patches. + +Reported-by: Guenter Roeck +Link: https://lore.kernel.org/r/cd10a924-ae65-4b02-aea2-e629947ca7a3@roeck-us.net +Cc: Hongbo Li +Cc: Christian Brauner +Cc: Sasha Levin +Cc: Nathan Chancellor +Cc: Richard Weinberger +Signed-off-by: Greg Kroah-Hartman +--- + fs/hostfs/hostfs_kern.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -925,8 +925,8 @@ static const struct inode_operations hos + static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc) + { + struct hostfs_fs_info *fsi = sb->s_fs_info; +- const char *host_root = fc->source; + struct inode *root_inode; ++ char *host_root = fc->source; + int err; + + sb->s_blocksize = 1024; diff --git a/queue-6.6/revert-hostfs-convert-hostfs-to-use-the-new-mount-api.patch b/queue-6.6/revert-hostfs-convert-hostfs-to-use-the-new-mount-api.patch new file mode 100644 index 0000000000..01544685b4 --- /dev/null +++ b/queue-6.6/revert-hostfs-convert-hostfs-to-use-the-new-mount-api.patch @@ -0,0 +1,185 @@ +From a073f1c7fcb03235754a19c2423971e9eeee0d01 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 11 Feb 2025 09:21:02 +0100 +Subject: Revert "hostfs: convert hostfs to use the new mount API" + +From: Greg Kroah-Hartman + +This reverts commit d073828fe0f5cd9531bb918ab0b5a7b920b1bfdb which is +commit cd140ce9f611a5e9d2a5989a282b75e55c71dab3 upstream. + +It is reported to cause build issues and odds are the root problem isn't +really an issue on the 6.6.y branch anyway. If it is, someone can +provide a working set of backported patches. + +Reported-by: Guenter Roeck +Link: https://lore.kernel.org/r/cd10a924-ae65-4b02-aea2-e629947ca7a3@roeck-us.net +Cc: Hongbo Li +Cc: Christian Brauner +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/hostfs/hostfs_kern.c | 83 ++++++++++++------------------------------------ + 1 file changed, 21 insertions(+), 62 deletions(-) + +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -16,16 +16,11 @@ + #include + #include + #include +-#include + #include + #include "hostfs.h" + #include + #include + +-struct hostfs_fs_info { +- char *host_root_path; +-}; +- + struct hostfs_inode_info { + int fd; + fmode_t mode; +@@ -95,10 +90,8 @@ static char *__dentry_name(struct dentry + char *p = dentry_path_raw(dentry, name, PATH_MAX); + char *root; + size_t len; +- struct hostfs_fs_info *fsi; + +- fsi = dentry->d_sb->s_fs_info; +- root = fsi->host_root_path; ++ root = dentry->d_sb->s_fs_info; + len = strlen(root); + if (IS_ERR(p)) { + __putname(name); +@@ -203,10 +196,8 @@ static int hostfs_statfs(struct dentry * + long long f_bavail; + long long f_files; + long long f_ffree; +- struct hostfs_fs_info *fsi; + +- fsi = dentry->d_sb->s_fs_info; +- err = do_statfs(fsi->host_root_path, ++ err = do_statfs(dentry->d_sb->s_fs_info, + &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, + &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), + &sf->f_namelen); +@@ -254,11 +245,7 @@ static void hostfs_free_inode(struct ino + + static int hostfs_show_options(struct seq_file *seq, struct dentry *root) + { +- struct hostfs_fs_info *fsi; +- const char *root_path; +- +- fsi = root->d_sb->s_fs_info; +- root_path = fsi->host_root_path; ++ const char *root_path = root->d_sb->s_fs_info; + size_t offset = strlen(root_ino) + 1; + + if (strlen(root_path) > offset) +@@ -937,11 +924,10 @@ static const struct inode_operations hos + .get_link = hostfs_get_link, + }; + +-static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc) ++static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) + { +- struct hostfs_fs_info *fsi = sb->s_fs_info; + struct inode *root_inode; +- char *host_root = fc->source; ++ char *host_root_path, *req_root = d; + int err; + + sb->s_blocksize = 1024; +@@ -955,15 +941,15 @@ static int hostfs_fill_super(struct supe + return err; + + /* NULL is printed as '(null)' by printf(): avoid that. */ +- if (fc->source == NULL) +- host_root = ""; ++ if (req_root == NULL) ++ req_root = ""; + +- fsi->host_root_path = +- kasprintf(GFP_KERNEL, "%s/%s", root_ino, host_root); +- if (fsi->host_root_path == NULL) ++ sb->s_fs_info = host_root_path = ++ kasprintf(GFP_KERNEL, "%s/%s", root_ino, req_root); ++ if (host_root_path == NULL) + return -ENOMEM; + +- root_inode = hostfs_iget(sb, fsi->host_root_path); ++ root_inode = hostfs_iget(sb, host_root_path); + if (IS_ERR(root_inode)) + return PTR_ERR(root_inode); + +@@ -971,7 +957,7 @@ static int hostfs_fill_super(struct supe + char *name; + + iput(root_inode); +- name = follow_link(fsi->host_root_path); ++ name = follow_link(host_root_path); + if (IS_ERR(name)) + return PTR_ERR(name); + +@@ -988,38 +974,11 @@ static int hostfs_fill_super(struct supe + return 0; + } + +-static int hostfs_fc_get_tree(struct fs_context *fc) ++static struct dentry *hostfs_read_sb(struct file_system_type *type, ++ int flags, const char *dev_name, ++ void *data) + { +- return get_tree_nodev(fc, hostfs_fill_super); +-} +- +-static void hostfs_fc_free(struct fs_context *fc) +-{ +- struct hostfs_fs_info *fsi = fc->s_fs_info; +- +- if (!fsi) +- return; +- +- kfree(fsi->host_root_path); +- kfree(fsi); +-} +- +-static const struct fs_context_operations hostfs_context_ops = { +- .get_tree = hostfs_fc_get_tree, +- .free = hostfs_fc_free, +-}; +- +-static int hostfs_init_fs_context(struct fs_context *fc) +-{ +- struct hostfs_fs_info *fsi; +- +- fsi = kzalloc(sizeof(*fsi), GFP_KERNEL); +- if (!fsi) +- return -ENOMEM; +- +- fc->s_fs_info = fsi; +- fc->ops = &hostfs_context_ops; +- return 0; ++ return mount_nodev(type, flags, data, hostfs_fill_sb_common); + } + + static void hostfs_kill_sb(struct super_block *s) +@@ -1029,11 +988,11 @@ static void hostfs_kill_sb(struct super_ + } + + static struct file_system_type hostfs_type = { +- .owner = THIS_MODULE, +- .name = "hostfs", +- .init_fs_context = hostfs_init_fs_context, +- .kill_sb = hostfs_kill_sb, +- .fs_flags = 0, ++ .owner = THIS_MODULE, ++ .name = "hostfs", ++ .mount = hostfs_read_sb, ++ .kill_sb = hostfs_kill_sb, ++ .fs_flags = 0, + }; + MODULE_ALIAS_FS("hostfs"); + diff --git a/queue-6.6/revert-hostfs-fix-string-handling-in-__dentry_name.patch b/queue-6.6/revert-hostfs-fix-string-handling-in-__dentry_name.patch new file mode 100644 index 0000000000..9faed2b6e7 --- /dev/null +++ b/queue-6.6/revert-hostfs-fix-string-handling-in-__dentry_name.patch @@ -0,0 +1,66 @@ +From 33b09bd2938880fc90db754dadd9f121188427bb Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 11 Feb 2025 09:20:53 +0100 +Subject: Revert "hostfs: fix string handling in __dentry_name()" + +From: Greg Kroah-Hartman + +This reverts commit 86ec56b25476758f708328b2eeed68918567efd0 which is +commit 60a6002432448bb3f291d80768ae98d62efc9c77 upstream. + +It is reported to cause build issues and odds are the root problem isn't +really an issue on the 6.6.y branch anyway. If it is, someone can +provide a working set of backported patches. + +Reported-by: Guenter Roeck +Link: https://lore.kernel.org/r/cd10a924-ae65-4b02-aea2-e629947ca7a3@roeck-us.net +Cc: Hongbo Li +Cc: Christian Brauner +Cc: Sasha Levin +Cc: Al Viro +Signed-off-by: Greg Kroah-Hartman +--- + fs/hostfs/hostfs_kern.c | 27 +++++++++++++++++++++------ + 1 file changed, 21 insertions(+), 6 deletions(-) + +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -93,17 +93,32 @@ __uml_setup("hostfs=", hostfs_args, + static char *__dentry_name(struct dentry *dentry, char *name) + { + char *p = dentry_path_raw(dentry, name, PATH_MAX); +- struct hostfs_fs_info *fsi = dentry->d_sb->s_fs_info; +- char *root = fsi->host_root_path; +- size_t len = strlen(root); ++ char *root; ++ size_t len; ++ struct hostfs_fs_info *fsi; + +- if (IS_ERR(p) || len > p - name) { ++ fsi = dentry->d_sb->s_fs_info; ++ root = fsi->host_root_path; ++ len = strlen(root); ++ if (IS_ERR(p)) { + __putname(name); + return NULL; + } + +- memcpy(name, root, len); +- memmove(name + len, p, name + PATH_MAX - p); ++ /* ++ * This function relies on the fact that dentry_path_raw() will place ++ * the path name at the end of the provided buffer. ++ */ ++ BUG_ON(p + strlen(p) + 1 != name + PATH_MAX); ++ ++ strscpy(name, root, PATH_MAX); ++ if (len > p - name) { ++ __putname(name); ++ return NULL; ++ } ++ ++ if (p > name + len) ++ strcpy(name + len, p); + + return name; + } diff --git a/queue-6.6/revert-hostfs-fix-the-host-directory-parse-when-mounting.patch b/queue-6.6/revert-hostfs-fix-the-host-directory-parse-when-mounting.patch new file mode 100644 index 0000000000..a2b533d1f5 --- /dev/null +++ b/queue-6.6/revert-hostfs-fix-the-host-directory-parse-when-mounting.patch @@ -0,0 +1,126 @@ +From 78976dc6f4b6b7481a510650831e7b9c95a7c5d9 Mon Sep 17 00:00:00 2001 +From: Greg Kroah-Hartman +Date: Tue, 11 Feb 2025 09:20:33 +0100 +Subject: Revert "hostfs: fix the host directory parse when mounting." + +From: Greg Kroah-Hartman + +This reverts commit be80de30b347dc2eae35dd5f7905ad9c9167dc08 which is +commit ef9ca17ca458ac7253ae71b552e601e49311fc48 upstream. + +It is reported to cause build issues and odds are the root problem isn't +really an issue on the 6.6.y branch anyway. If it is, someone can +provide a working set of backported patches. + +Reported-by: Guenter Roeck +Link: https://lore.kernel.org/r/cd10a924-ae65-4b02-aea2-e629947ca7a3@roeck-us.net +Cc: Hongbo Li +Cc: Christian Brauner +Cc: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + fs/hostfs/hostfs_kern.c | 65 +++++++----------------------------------------- + 1 file changed, 10 insertions(+), 55 deletions(-) + +--- a/fs/hostfs/hostfs_kern.c ++++ b/fs/hostfs/hostfs_kern.c +@@ -17,7 +17,6 @@ + #include + #include + #include +-#include + #include + #include "hostfs.h" + #include +@@ -926,6 +925,7 @@ static const struct inode_operations hos + static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc) + { + struct hostfs_fs_info *fsi = sb->s_fs_info; ++ const char *host_root = fc->source; + struct inode *root_inode; + int err; + +@@ -939,6 +939,15 @@ static int hostfs_fill_super(struct supe + if (err) + return err; + ++ /* NULL is printed as '(null)' by printf(): avoid that. */ ++ if (fc->source == NULL) ++ host_root = ""; ++ ++ fsi->host_root_path = ++ kasprintf(GFP_KERNEL, "%s/%s", root_ino, host_root); ++ if (fsi->host_root_path == NULL) ++ return -ENOMEM; ++ + root_inode = hostfs_iget(sb, fsi->host_root_path); + if (IS_ERR(root_inode)) + return PTR_ERR(root_inode); +@@ -964,58 +973,6 @@ static int hostfs_fill_super(struct supe + return 0; + } + +-enum hostfs_parma { +- Opt_hostfs, +-}; +- +-static const struct fs_parameter_spec hostfs_param_specs[] = { +- fsparam_string_empty("hostfs", Opt_hostfs), +- {} +-}; +- +-static int hostfs_parse_param(struct fs_context *fc, struct fs_parameter *param) +-{ +- struct hostfs_fs_info *fsi = fc->s_fs_info; +- struct fs_parse_result result; +- char *host_root; +- int opt; +- +- opt = fs_parse(fc, hostfs_param_specs, param, &result); +- if (opt < 0) +- return opt; +- +- switch (opt) { +- case Opt_hostfs: +- host_root = param->string; +- if (!*host_root) +- host_root = ""; +- fsi->host_root_path = +- kasprintf(GFP_KERNEL, "%s/%s", root_ino, host_root); +- if (fsi->host_root_path == NULL) +- return -ENOMEM; +- break; +- } +- +- return 0; +-} +- +-static int hostfs_parse_monolithic(struct fs_context *fc, void *data) +-{ +- struct hostfs_fs_info *fsi = fc->s_fs_info; +- char *host_root = (char *)data; +- +- /* NULL is printed as '(null)' by printf(): avoid that. */ +- if (host_root == NULL) +- host_root = ""; +- +- fsi->host_root_path = +- kasprintf(GFP_KERNEL, "%s/%s", root_ino, host_root); +- if (fsi->host_root_path == NULL) +- return -ENOMEM; +- +- return 0; +-} +- + static int hostfs_fc_get_tree(struct fs_context *fc) + { + return get_tree_nodev(fc, hostfs_fill_super); +@@ -1033,8 +990,6 @@ static void hostfs_fc_free(struct fs_con + } + + static const struct fs_context_operations hostfs_context_ops = { +- .parse_monolithic = hostfs_parse_monolithic, +- .parse_param = hostfs_parse_param, + .get_tree = hostfs_fc_get_tree, + .free = hostfs_fc_free, + }; diff --git a/queue-6.6/series b/queue-6.6/series new file mode 100644 index 0000000000..7bbdf9e53e --- /dev/null +++ b/queue-6.6/series @@ -0,0 +1,4 @@ +revert-hostfs-fix-the-host-directory-parse-when-mounting.patch +revert-hostfs-add-const-qualifier-to-host_root-in-hostfs_fill_super.patch +revert-hostfs-fix-string-handling-in-__dentry_name.patch +revert-hostfs-convert-hostfs-to-use-the-new-mount-api.patch