diff options
-rw-r--r-- | fs/cifs/smb2ops.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index a930c8965e5c..466554cdff4b 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SMB2 version specific operations | 3 | * SMB2 version specific operations |
3 | * | 4 | * |
@@ -282,7 +283,7 @@ smb2_find_mid(struct TCP_Server_Info *server, char *buf) | |||
282 | __u64 wire_mid = le64_to_cpu(shdr->MessageId); | 283 | __u64 wire_mid = le64_to_cpu(shdr->MessageId); |
283 | 284 | ||
284 | if (shdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) { | 285 | if (shdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) { |
285 | cifs_dbg(VFS, "encrypted frame parsing not supported yet"); | 286 | cifs_dbg(VFS, "Encrypted frame parsing not supported yet\n"); |
286 | return NULL; | 287 | return NULL; |
287 | } | 288 | } |
288 | 289 | ||
@@ -324,6 +325,7 @@ static int | |||
324 | smb2_negotiate(const unsigned int xid, struct cifs_ses *ses) | 325 | smb2_negotiate(const unsigned int xid, struct cifs_ses *ses) |
325 | { | 326 | { |
326 | int rc; | 327 | int rc; |
328 | |||
327 | ses->server->CurrentMid = 0; | 329 | ses->server->CurrentMid = 0; |
328 | rc = SMB2_negotiate(xid, ses); | 330 | rc = SMB2_negotiate(xid, ses); |
329 | /* BB we probably don't need to retry with modern servers */ | 331 | /* BB we probably don't need to retry with modern servers */ |
@@ -789,8 +791,6 @@ smb3_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) | |||
789 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | 791 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); |
790 | else | 792 | else |
791 | close_shroot(&tcon->crfid); | 793 | close_shroot(&tcon->crfid); |
792 | |||
793 | return; | ||
794 | } | 794 | } |
795 | 795 | ||
796 | static void | 796 | static void |
@@ -818,7 +818,6 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon) | |||
818 | SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, | 818 | SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, |
819 | FS_DEVICE_INFORMATION); | 819 | FS_DEVICE_INFORMATION); |
820 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | 820 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); |
821 | return; | ||
822 | } | 821 | } |
823 | 822 | ||
824 | static int | 823 | static int |
@@ -906,9 +905,8 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, | |||
906 | value = &src->ea_data[src->ea_name_length + 1]; | 905 | value = &src->ea_data[src->ea_name_length + 1]; |
907 | value_len = (size_t)le16_to_cpu(src->ea_value_length); | 906 | value_len = (size_t)le16_to_cpu(src->ea_value_length); |
908 | 907 | ||
909 | if (name_len == 0) { | 908 | if (name_len == 0) |
910 | break; | 909 | break; |
911 | } | ||
912 | 910 | ||
913 | if (src_size < 8 + name_len + 1 + value_len) { | 911 | if (src_size < 8 + name_len + 1 + value_len) { |
914 | cifs_dbg(FYI, "EA entry goes beyond length of list\n"); | 912 | cifs_dbg(FYI, "EA entry goes beyond length of list\n"); |
@@ -1161,6 +1159,7 @@ static void | |||
1161 | smb2_clear_stats(struct cifs_tcon *tcon) | 1159 | smb2_clear_stats(struct cifs_tcon *tcon) |
1162 | { | 1160 | { |
1163 | int i; | 1161 | int i; |
1162 | |||
1164 | for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) { | 1163 | for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) { |
1165 | atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0); | 1164 | atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0); |
1166 | atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0); | 1165 | atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0); |
@@ -1529,7 +1528,7 @@ smb2_copychunk_range(const unsigned int xid, | |||
1529 | if (pcchunk == NULL) | 1528 | if (pcchunk == NULL) |
1530 | return -ENOMEM; | 1529 | return -ENOMEM; |
1531 | 1530 | ||
1532 | cifs_dbg(FYI, "in smb2_copychunk_range - about to call request res key\n"); | 1531 | cifs_dbg(FYI, "%s: about to call request res key\n", __func__); |
1533 | /* Request a key from the server to identify the source of the copy */ | 1532 | /* Request a key from the server to identify the source of the copy */ |
1534 | rc = SMB2_request_res_key(xid, tlink_tcon(srcfile->tlink), | 1533 | rc = SMB2_request_res_key(xid, tlink_tcon(srcfile->tlink), |
1535 | srcfile->fid.persistent_fid, | 1534 | srcfile->fid.persistent_fid, |
@@ -1649,6 +1648,7 @@ static unsigned int | |||
1649 | smb2_read_data_offset(char *buf) | 1648 | smb2_read_data_offset(char *buf) |
1650 | { | 1649 | { |
1651 | struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf; | 1650 | struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf; |
1651 | |||
1652 | return rsp->DataOffset; | 1652 | return rsp->DataOffset; |
1653 | } | 1653 | } |
1654 | 1654 | ||
@@ -1777,7 +1777,7 @@ smb2_duplicate_extents(const unsigned int xid, | |||
1777 | dup_ext_buf.SourceFileOffset = cpu_to_le64(src_off); | 1777 | dup_ext_buf.SourceFileOffset = cpu_to_le64(src_off); |
1778 | dup_ext_buf.TargetFileOffset = cpu_to_le64(dest_off); | 1778 | dup_ext_buf.TargetFileOffset = cpu_to_le64(dest_off); |
1779 | dup_ext_buf.ByteCount = cpu_to_le64(len); | 1779 | dup_ext_buf.ByteCount = cpu_to_le64(len); |
1780 | cifs_dbg(FYI, "duplicate extents: src off %lld dst off %lld len %lld", | 1780 | cifs_dbg(FYI, "Duplicate extents: src off %lld dst off %lld len %lld\n", |
1781 | src_off, dest_off, len); | 1781 | src_off, dest_off, len); |
1782 | 1782 | ||
1783 | rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false); | 1783 | rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false); |
@@ -1794,7 +1794,7 @@ smb2_duplicate_extents(const unsigned int xid, | |||
1794 | &ret_data_len); | 1794 | &ret_data_len); |
1795 | 1795 | ||
1796 | if (ret_data_len > 0) | 1796 | if (ret_data_len > 0) |
1797 | cifs_dbg(FYI, "non-zero response length in duplicate extents"); | 1797 | cifs_dbg(FYI, "Non-zero response length in duplicate extents\n"); |
1798 | 1798 | ||
1799 | duplicate_extents_out: | 1799 | duplicate_extents_out: |
1800 | return rc; | 1800 | return rc; |
@@ -1983,9 +1983,9 @@ smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon, | |||
1983 | } | 1983 | } |
1984 | 1984 | ||
1985 | /* | 1985 | /* |
1986 | * If we negotiate SMB2 protocol and get STATUS_PENDING - update | 1986 | * If we negotiate SMB2 protocol and get STATUS_PENDING - update |
1987 | * the number of credits and return true. Otherwise - return false. | 1987 | * the number of credits and return true. Otherwise - return false. |
1988 | */ | 1988 | */ |
1989 | static bool | 1989 | static bool |
1990 | smb2_is_status_pending(char *buf, struct TCP_Server_Info *server) | 1990 | smb2_is_status_pending(char *buf, struct TCP_Server_Info *server) |
1991 | { | 1991 | { |
@@ -2306,7 +2306,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses, | |||
2306 | struct get_dfs_referral_rsp *dfs_rsp = NULL; | 2306 | struct get_dfs_referral_rsp *dfs_rsp = NULL; |
2307 | u32 dfs_req_size = 0, dfs_rsp_size = 0; | 2307 | u32 dfs_req_size = 0, dfs_rsp_size = 0; |
2308 | 2308 | ||
2309 | cifs_dbg(FYI, "smb2_get_dfs_refer path <%s>\n", search_name); | 2309 | cifs_dbg(FYI, "%s: path: %s\n", __func__, search_name); |
2310 | 2310 | ||
2311 | /* | 2311 | /* |
2312 | * Try to use the IPC tcon, otherwise just use any | 2312 | * Try to use the IPC tcon, otherwise just use any |
@@ -2360,7 +2360,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses, | |||
2360 | 2360 | ||
2361 | if (rc) { | 2361 | if (rc) { |
2362 | if ((rc != -ENOENT) && (rc != -EOPNOTSUPP)) | 2362 | if ((rc != -ENOENT) && (rc != -EOPNOTSUPP)) |
2363 | cifs_dbg(VFS, "ioctl error in smb2_get_dfs_refer rc=%d\n", rc); | 2363 | cifs_dbg(VFS, "ioctl error in %s rc=%d\n", __func__, rc); |
2364 | goto out; | 2364 | goto out; |
2365 | } | 2365 | } |
2366 | 2366 | ||
@@ -2369,7 +2369,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses, | |||
2369 | nls_codepage, remap, search_name, | 2369 | nls_codepage, remap, search_name, |
2370 | true /* is_unicode */); | 2370 | true /* is_unicode */); |
2371 | if (rc) { | 2371 | if (rc) { |
2372 | cifs_dbg(VFS, "parse error in smb2_get_dfs_refer rc=%d\n", rc); | 2372 | cifs_dbg(VFS, "parse error in %s rc=%d\n", __func__, rc); |
2373 | goto out; | 2373 | goto out; |
2374 | } | 2374 | } |
2375 | 2375 | ||
@@ -2745,7 +2745,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | |||
2745 | inode = d_inode(cfile->dentry); | 2745 | inode = d_inode(cfile->dentry); |
2746 | cifsi = CIFS_I(inode); | 2746 | cifsi = CIFS_I(inode); |
2747 | 2747 | ||
2748 | trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid, | 2748 | trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid, |
2749 | ses->Suid, offset, len); | 2749 | ses->Suid, offset, len); |
2750 | 2750 | ||
2751 | 2751 | ||
@@ -2816,7 +2816,7 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, | |||
2816 | return rc; | 2816 | return rc; |
2817 | } | 2817 | } |
2818 | 2818 | ||
2819 | cifs_dbg(FYI, "offset %lld len %lld", offset, len); | 2819 | cifs_dbg(FYI, "Offset %lld len %lld\n", offset, len); |
2820 | 2820 | ||
2821 | fsctl_buf.FileOffset = cpu_to_le64(offset); | 2821 | fsctl_buf.FileOffset = cpu_to_le64(offset); |
2822 | fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); | 2822 | fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len); |
@@ -3384,7 +3384,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, | |||
3384 | 3384 | ||
3385 | req = aead_request_alloc(tfm, GFP_KERNEL); | 3385 | req = aead_request_alloc(tfm, GFP_KERNEL); |
3386 | if (!req) { | 3386 | if (!req) { |
3387 | cifs_dbg(VFS, "%s: Failed to alloc aead request", __func__); | 3387 | cifs_dbg(VFS, "%s: Failed to alloc aead request\n", __func__); |
3388 | return -ENOMEM; | 3388 | return -ENOMEM; |
3389 | } | 3389 | } |
3390 | 3390 | ||
@@ -3395,7 +3395,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, | |||
3395 | 3395 | ||
3396 | sg = init_sg(num_rqst, rqst, sign); | 3396 | sg = init_sg(num_rqst, rqst, sign); |
3397 | if (!sg) { | 3397 | if (!sg) { |
3398 | cifs_dbg(VFS, "%s: Failed to init sg", __func__); | 3398 | cifs_dbg(VFS, "%s: Failed to init sg\n", __func__); |
3399 | rc = -ENOMEM; | 3399 | rc = -ENOMEM; |
3400 | goto free_req; | 3400 | goto free_req; |
3401 | } | 3401 | } |
@@ -3403,7 +3403,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, | |||
3403 | iv_len = crypto_aead_ivsize(tfm); | 3403 | iv_len = crypto_aead_ivsize(tfm); |
3404 | iv = kzalloc(iv_len, GFP_KERNEL); | 3404 | iv = kzalloc(iv_len, GFP_KERNEL); |
3405 | if (!iv) { | 3405 | if (!iv) { |
3406 | cifs_dbg(VFS, "%s: Failed to alloc IV", __func__); | 3406 | cifs_dbg(VFS, "%s: Failed to alloc iv\n", __func__); |
3407 | rc = -ENOMEM; | 3407 | rc = -ENOMEM; |
3408 | goto free_sg; | 3408 | goto free_sg; |
3409 | } | 3409 | } |
@@ -3511,7 +3511,7 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst, | |||
3511 | fill_transform_hdr(tr_hdr, orig_len, old_rq); | 3511 | fill_transform_hdr(tr_hdr, orig_len, old_rq); |
3512 | 3512 | ||
3513 | rc = crypt_message(server, num_rqst, new_rq, 1); | 3513 | rc = crypt_message(server, num_rqst, new_rq, 1); |
3514 | cifs_dbg(FYI, "encrypt message returned %d", rc); | 3514 | cifs_dbg(FYI, "Encrypt message returned %d\n", rc); |
3515 | if (rc) | 3515 | if (rc) |
3516 | goto err_free; | 3516 | goto err_free; |
3517 | 3517 | ||
@@ -3552,7 +3552,7 @@ decrypt_raw_data(struct TCP_Server_Info *server, char *buf, | |||
3552 | rqst.rq_tailsz = (page_data_size % PAGE_SIZE) ? : PAGE_SIZE; | 3552 | rqst.rq_tailsz = (page_data_size % PAGE_SIZE) ? : PAGE_SIZE; |
3553 | 3553 | ||
3554 | rc = crypt_message(server, 1, &rqst, 0); | 3554 | rc = crypt_message(server, 1, &rqst, 0); |
3555 | cifs_dbg(FYI, "decrypt message returned %d\n", rc); | 3555 | cifs_dbg(FYI, "Decrypt message returned %d\n", rc); |
3556 | 3556 | ||
3557 | if (rc) | 3557 | if (rc) |
3558 | return rc; | 3558 | return rc; |