From: yangerkun
maillist inclusion
category: bugfix
issue: #I4NRS5
CVE: NA
Signed-off-by: Yu Changchun
---------------------------
ramfs_parse_param does not parse key "source", and will convert -ENOPARAM
to 0. This will skip vfs_parse_fs_param_source in vfs_parse_fs_param,
which lead always "none" mount source for ramfs. Fix it by parse "source"
in ramfs_parse_param like cgroup1_parse_param has do.
Link: https://lkml.kernel.org/r/20210924091756.1906118-1-yangerkun@huawei.com
Signed-off-by: yangerkun
Cc: Al Viro
Signed-off-by: Andrew Morton
Signed-off-by: Stephen Rothwell
Reviewed-by: Zhang Yi
Signed-off-by: Chen Jun
Signed-off-by: Zheng Zengkai
Signed-off-by: Yu Changchun
---
fs/ramfs/inode.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..0163dcff9318 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -193,17 +193,20 @@ static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
int opt;
opt = fs_parse(fc, ramfs_fs_parameters, param, &result);
- if (opt < 0) {
+ if (opt == -ENOPARAM) {
+ opt = vfs_parse_fs_param_source(fc, param);
+ if (opt != -ENOPARAM)
+ return opt;
/*
* We might like to report bad mount options here;
* but traditionally ramfs has ignored all mount options,
* and as it is used as a !CONFIG_SHMEM simple substitute
* for tmpfs, better continue to ignore other mount options.
*/
- if (opt == -ENOPARAM)
- opt = 0;
- return opt;
+ return 0;
}
+ if (opt < 0)
+ return opt;
switch (opt) {
case Opt_mode:
--
2.25.1