* [PATCH] cifs: returning mount parm processing errors correctly
@ 2021-01-28 22:52 Steve French
2021-01-29 2:07 ` ronnie sahlberg
0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2021-01-28 22:52 UTC (permalink / raw)
To: CIFS; +Cc: ronnie sahlberg
During additional testing of the updated cifs.ko with the
new mount API support, we found a few additional cases where
we were logging errors, but not returning them to the user.
For example:
a) invalid security mechanisms
b) invalid cache options
c) unsupported rdma
d) invalid smb dialect requested
Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")
Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 818c413db82d..27354417e988 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -533,7 +533,7 @@ static int smb3_fs_context_validate(struct fs_context *fc)
if (ctx->rdma && ctx->vals->protocol_id < SMB30_PROT_ID) {
cifs_dbg(VFS, "SMB Direct requires Version >=3.0\n");
- return -1;
+ return -EOPNOTSUPP;
}
#ifndef CONFIG_KEYS
@@ -556,7 +556,7 @@ static int smb3_fs_context_validate(struct fs_context *fc)
/* make sure UNC has a share name */
if (strlen(ctx->UNC) < 3 || !strchr(ctx->UNC + 3, '\\')) {
cifs_dbg(VFS, "Malformed UNC. Unable to find share name.\n");
- return -1;
+ return -ENOENT;
}
if (!ctx->got_ip) {
@@ -570,7 +570,7 @@ static int smb3_fs_context_validate(struct fs_context *fc)
if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr,
&ctx->UNC[2], len)) {
pr_err("Unable to determine destination address\n");
- return -1;
+ return -EHOSTUNREACH;
}
}
@@ -1265,7 +1265,7 @@ static int smb3_fs_context_parse_param(struct
fs_context *fc,
return 0;
cifs_parse_mount_err:
- return 1;
+ return -EINVAL;
}
int smb3_init_fs_context(struct fs_context *fc)
--
Thanks,
Steve
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cifs: returning mount parm processing errors correctly
2021-01-28 22:52 [PATCH] cifs: returning mount parm processing errors correctly Steve French
@ 2021-01-29 2:07 ` ronnie sahlberg
0 siblings, 0 replies; 2+ messages in thread
From: ronnie sahlberg @ 2021-01-29 2:07 UTC (permalink / raw)
To: Steve French; +Cc: CIFS
acked-by me
On Fri, Jan 29, 2021 at 8:52 AM Steve French <smfrench@gmail.com> wrote:
>
> During additional testing of the updated cifs.ko with the
> new mount API support, we found a few additional cases where
> we were logging errors, but not returning them to the user.
>
> For example:
> a) invalid security mechanisms
> b) invalid cache options
> c) unsupported rdma
> d) invalid smb dialect requested
>
> Fixes: 24e0a1eff9e2 ("cifs: switch to new mount api")
> Acked-by: Ronnie Sahlberg <lsahlber@redhat.com>
> Signed-off-by: Steve French <stfrench@microsoft.com>
>
> diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
> index 818c413db82d..27354417e988 100644
> --- a/fs/cifs/fs_context.c
> +++ b/fs/cifs/fs_context.c
> @@ -533,7 +533,7 @@ static int smb3_fs_context_validate(struct fs_context *fc)
>
> if (ctx->rdma && ctx->vals->protocol_id < SMB30_PROT_ID) {
> cifs_dbg(VFS, "SMB Direct requires Version >=3.0\n");
> - return -1;
> + return -EOPNOTSUPP;
> }
>
> #ifndef CONFIG_KEYS
> @@ -556,7 +556,7 @@ static int smb3_fs_context_validate(struct fs_context *fc)
> /* make sure UNC has a share name */
> if (strlen(ctx->UNC) < 3 || !strchr(ctx->UNC + 3, '\\')) {
> cifs_dbg(VFS, "Malformed UNC. Unable to find share name.\n");
> - return -1;
> + return -ENOENT;
> }
>
> if (!ctx->got_ip) {
> @@ -570,7 +570,7 @@ static int smb3_fs_context_validate(struct fs_context *fc)
> if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr,
> &ctx->UNC[2], len)) {
> pr_err("Unable to determine destination address\n");
> - return -1;
> + return -EHOSTUNREACH;
> }
> }
>
> @@ -1265,7 +1265,7 @@ static int smb3_fs_context_parse_param(struct
> fs_context *fc,
> return 0;
>
> cifs_parse_mount_err:
> - return 1;
> + return -EINVAL;
> }
>
> int smb3_init_fs_context(struct fs_context *fc)
>
>
> --
> Thanks,
>
> Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-29 2:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 22:52 [PATCH] cifs: returning mount parm processing errors correctly Steve French
2021-01-29 2:07 ` ronnie sahlberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.