diff mbox series

ksmbd: return STATUS_BAD_NETWORK_NAME error status if share is not configured

Message ID 20220808125648.10919-1-linkinjeon@kernel.org (mailing list archive)
State New, archived
Headers show
Series ksmbd: return STATUS_BAD_NETWORK_NAME error status if share is not configured | expand

Commit Message

Namjae Jeon Aug. 8, 2022, 12:56 p.m. UTC
If share is not configured in smb.conf, smb2 tree connect should return
STATUS_BAD_NETWORK_NAME instead of STATUS_BAD_NETWORK_PATH.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/ksmbd/mgmt/tree_connect.c | 2 +-
 fs/ksmbd/smb2pdu.c           | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Hyunchul Lee Aug. 9, 2022, 2:06 a.m. UTC | #1
2022년 8월 8일 (월) 오후 9:57, Namjae Jeon <linkinjeon@kernel.org>님이 작성:
>
> If share is not configured in smb.conf, smb2 tree connect should return
> STATUS_BAD_NETWORK_NAME instead of STATUS_BAD_NETWORK_PATH.
>
> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>

Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>

> ---
>  fs/ksmbd/mgmt/tree_connect.c | 2 +-
>  fs/ksmbd/smb2pdu.c           | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ksmbd/mgmt/tree_connect.c b/fs/ksmbd/mgmt/tree_connect.c
> index b35ea6a6abc5..dd262daa2c4a 100644
> --- a/fs/ksmbd/mgmt/tree_connect.c
> +++ b/fs/ksmbd/mgmt/tree_connect.c
> @@ -19,7 +19,7 @@ struct ksmbd_tree_conn_status
>  ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess,
>                         char *share_name)
>  {
> -       struct ksmbd_tree_conn_status status = {-EINVAL, NULL};
> +       struct ksmbd_tree_conn_status status = {-ENOENT, NULL};
>         struct ksmbd_tree_connect_response *resp = NULL;
>         struct ksmbd_share_config *sc;
>         struct ksmbd_tree_connect *tree_conn = NULL;
> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
> index 4c3c840df455..d478c3ea4215 100644
> --- a/fs/ksmbd/smb2pdu.c
> +++ b/fs/ksmbd/smb2pdu.c
> @@ -1944,8 +1944,9 @@ int smb2_tree_connect(struct ksmbd_work *work)
>                 rsp->hdr.Status = STATUS_SUCCESS;
>                 rc = 0;
>                 break;
> +       case -ENOENT:
>         case KSMBD_TREE_CONN_STATUS_NO_SHARE:
> -               rsp->hdr.Status = STATUS_BAD_NETWORK_PATH;
> +               rsp->hdr.Status = STATUS_BAD_NETWORK_NAME;
>                 break;
>         case -ENOMEM:
>         case KSMBD_TREE_CONN_STATUS_NOMEM:
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/fs/ksmbd/mgmt/tree_connect.c b/fs/ksmbd/mgmt/tree_connect.c
index b35ea6a6abc5..dd262daa2c4a 100644
--- a/fs/ksmbd/mgmt/tree_connect.c
+++ b/fs/ksmbd/mgmt/tree_connect.c
@@ -19,7 +19,7 @@  struct ksmbd_tree_conn_status
 ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess,
 			char *share_name)
 {
-	struct ksmbd_tree_conn_status status = {-EINVAL, NULL};
+	struct ksmbd_tree_conn_status status = {-ENOENT, NULL};
 	struct ksmbd_tree_connect_response *resp = NULL;
 	struct ksmbd_share_config *sc;
 	struct ksmbd_tree_connect *tree_conn = NULL;
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 4c3c840df455..d478c3ea4215 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -1944,8 +1944,9 @@  int smb2_tree_connect(struct ksmbd_work *work)
 		rsp->hdr.Status = STATUS_SUCCESS;
 		rc = 0;
 		break;
+	case -ENOENT:
 	case KSMBD_TREE_CONN_STATUS_NO_SHARE:
-		rsp->hdr.Status = STATUS_BAD_NETWORK_PATH;
+		rsp->hdr.Status = STATUS_BAD_NETWORK_NAME;
 		break;
 	case -ENOMEM:
 	case KSMBD_TREE_CONN_STATUS_NOMEM: