Skip to content

Commit cdfb2fe

Browse files
Marios Makassikissmfrench
authored andcommitted
ksmbd: send proper error response in smb2_tree_connect()
Currently, smb2_tree_connect doesn't send an error response packet on error. This causes libsmb2 to skip the specific error code and fail with the following: smb2_service failed with : Failed to parse fixed part of command payload. Unexpected size of Error reply. Expected 9, got 8 Signed-off-by: Marios Makassikis <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 88603b6 commit cdfb2fe

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,13 +1928,13 @@ int smb2_tree_connect(struct ksmbd_work *work)
19281928
if (conn->posix_ext_supported)
19291929
status.tree_conn->posix_extensions = true;
19301930

1931-
out_err1:
19321931
rsp->StructureSize = cpu_to_le16(16);
1932+
inc_rfc1001_len(work->response_buf, 16);
1933+
out_err1:
19331934
rsp->Capabilities = 0;
19341935
rsp->Reserved = 0;
19351936
/* default manual caching */
19361937
rsp->ShareFlags = SMB2_SHAREFLAG_MANUAL_CACHING;
1937-
inc_rfc1001_len(work->response_buf, 16);
19381938

19391939
if (!IS_ERR(treename))
19401940
kfree(treename);
@@ -1967,6 +1967,9 @@ int smb2_tree_connect(struct ksmbd_work *work)
19671967
rsp->hdr.Status = STATUS_ACCESS_DENIED;
19681968
}
19691969

1970+
if (status.ret != KSMBD_TREE_CONN_STATUS_OK)
1971+
smb2_set_err_rsp(work);
1972+
19701973
return rc;
19711974
}
19721975

0 commit comments

Comments
 (0)