Re: [PATCH] vfs: Don't reject unknown parameters

From: Linus Torvalds
Date: Thu Dec 12 2019 - 12:57:01 EST


On Thu, Dec 12, 2019 at 9:47 AM Laura Abbott <labbott@xxxxxxxxxx> wrote:
>
> Good point, I think I missed how that code flow worked for printing
> out the error. I debated putting in a dummy parse_param but I
> figured that squashfs wouldn't be the only fs that didn't take
> arguments (it's in the minority but certainly not the only one).

I think printing out the error part is actually fine - it would act as
a warning for invalid parameters like this.

So I think a dummy parse_param that prints out a warning is likely the
right thing to do.

Something like the attached, perhaps? Totally untested.

Linus
fs/squashfs/super.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 0cc4ceec0562..fbd1e05b39aa 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -355,9 +355,18 @@ static int squashfs_reconfigure(struct fs_context *fc)
return 0;
}

+/* Print the warning, but ignore it as an error */
+static int squashfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
+{
+ invalf(fc, "%s: Unknown parameter '%s'",
+ fc->fs_type->name, param->key);
+ return 0;
+}
+
static const struct fs_context_operations squashfs_context_ops = {
.get_tree = squashfs_get_tree,
.reconfigure = squashfs_reconfigure,
+ .parse_param = squashfs_parse_param,
};

static int squashfs_init_fs_context(struct fs_context *fc)