Linux-Fsdevel Archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: fix negative option value parsing
@ 2022-07-25  0:13 Ian Kent
  0 siblings, 0 replies; only message in thread
From: Ian Kent @ 2022-07-25  0:13 UTC (permalink / raw
  To: Steve French; +Cc: linux-cifs, linux-fsdevel, Leif Sahlberg

The valid values of options that are defined with fsparam_u32() should
be positive.

But the fs parser will return a fail for values that are negative and
if the sloppy option is given success will then be returned resulting
in the option being silently ignored.

Also the sloppy option handling is meant to return success for invalid
options not valid options with invalid values.

Restricting the sloppy option override to handle failure returns for
invalid options only is sufficient to resolve these problems.

Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Leif Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/fs_context.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 8dc0d923ef6a..2dc5cdeee354 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -863,7 +863,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
 	if (!skip_parsing) {
 		opt = fs_parse(fc, smb3_fs_parameters, param, &result);
 		if (opt < 0)
-			return ctx->sloppy ? 1 : opt;
+			return (opt == -ENOPARAM && ctx->sloppy) ? 1 : opt;
 	}
 
 	switch (opt) {



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-25  0:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25  0:13 [PATCH] cifs: fix negative option value parsing Ian Kent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).