Commit 5e0c969e authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French

cifs: convert the path to utf16 in smb2_query_info_compound

and not in the callers.
Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 70ef3851
...@@ -1192,17 +1192,12 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1192,17 +1192,12 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb) struct cifs_sb_info *cifs_sb)
{ {
int rc; int rc;
__le16 *utf16_path;
struct kvec rsp_iov = {NULL, 0}; struct kvec rsp_iov = {NULL, 0};
int buftype = CIFS_NO_BUFFER; int buftype = CIFS_NO_BUFFER;
struct smb2_query_info_rsp *rsp; struct smb2_query_info_rsp *rsp;
struct smb2_file_full_ea_info *info = NULL; struct smb2_file_full_ea_info *info = NULL;
utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); rc = smb2_query_info_compound(xid, tcon, path,
if (!utf16_path)
return -ENOMEM;
rc = smb2_query_info_compound(xid, tcon, utf16_path,
FILE_READ_EA, FILE_READ_EA,
FILE_FULL_EA_INFORMATION, FILE_FULL_EA_INFORMATION,
SMB2_O_INFO_FILE, SMB2_O_INFO_FILE,
...@@ -1235,7 +1230,6 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1235,7 +1230,6 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
le32_to_cpu(rsp->OutputBufferLength), ea_name); le32_to_cpu(rsp->OutputBufferLength), ea_name);
qeas_exit: qeas_exit:
kfree(utf16_path);
free_rsp_buf(buftype, rsp_iov.iov_base); free_rsp_buf(buftype, rsp_iov.iov_base);
return rc; return rc;
} }
...@@ -1295,7 +1289,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -1295,7 +1289,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
* the new EA. If not we should not add it since we * the new EA. If not we should not add it since we
* would not be able to even read the EAs back. * would not be able to even read the EAs back.
*/ */
rc = smb2_query_info_compound(xid, tcon, utf16_path, rc = smb2_query_info_compound(xid, tcon, path,
FILE_READ_EA, FILE_READ_EA,
FILE_FULL_EA_INFORMATION, FILE_FULL_EA_INFORMATION,
SMB2_O_INFO_FILE, SMB2_O_INFO_FILE,
...@@ -2646,7 +2640,7 @@ smb2_set_next_command(struct cifs_tcon *tcon, struct smb_rqst *rqst) ...@@ -2646,7 +2640,7 @@ smb2_set_next_command(struct cifs_tcon *tcon, struct smb_rqst *rqst)
*/ */
int int
smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
__le16 *utf16_path, u32 desired_access, const char *path, u32 desired_access,
u32 class, u32 type, u32 output_len, u32 class, u32 type, u32 output_len,
struct kvec *rsp, int *buftype, struct kvec *rsp, int *buftype,
struct cifs_sb_info *cifs_sb) struct cifs_sb_info *cifs_sb)
...@@ -2664,6 +2658,13 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2664,6 +2658,13 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_open_parms oparms; struct cifs_open_parms oparms;
struct cifs_fid fid; struct cifs_fid fid;
int rc; int rc;
__le16 *utf16_path;
if (!path)
path = "";
utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
if (!utf16_path)
return -ENOMEM;
if (smb3_encryption_required(tcon)) if (smb3_encryption_required(tcon))
flags |= CIFS_TRANSFORM_REQ; flags |= CIFS_TRANSFORM_REQ;
...@@ -2729,6 +2730,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2729,6 +2730,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
*buftype = resp_buftype[1]; *buftype = resp_buftype[1];
qic_exit: qic_exit:
kfree(utf16_path);
SMB2_open_free(&rqst[0]); SMB2_open_free(&rqst[0]);
SMB2_query_info_free(&rqst[1]); SMB2_query_info_free(&rqst[1]);
SMB2_close_free(&rqst[2]); SMB2_close_free(&rqst[2]);
...@@ -2743,13 +2745,12 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -2743,13 +2745,12 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
{ {
struct smb2_query_info_rsp *rsp; struct smb2_query_info_rsp *rsp;
struct smb2_fs_full_size_info *info = NULL; struct smb2_fs_full_size_info *info = NULL;
__le16 utf16_path = 0; /* Null - open root of share */
struct kvec rsp_iov = {NULL, 0}; struct kvec rsp_iov = {NULL, 0};
int buftype = CIFS_NO_BUFFER; int buftype = CIFS_NO_BUFFER;
int rc; int rc;
rc = smb2_query_info_compound(xid, tcon, &utf16_path, rc = smb2_query_info_compound(xid, tcon, "",
FILE_READ_ATTRIBUTES, FILE_READ_ATTRIBUTES,
FS_FULL_SIZE_INFORMATION, FS_FULL_SIZE_INFORMATION,
SMB2_O_INFO_FILESYSTEM, SMB2_O_INFO_FILESYSTEM,
......
...@@ -283,7 +283,7 @@ extern int smb311_update_preauth_hash(struct cifs_ses *ses, ...@@ -283,7 +283,7 @@ extern int smb311_update_preauth_hash(struct cifs_ses *ses,
struct kvec *iov, int nvec); struct kvec *iov, int nvec);
extern int smb2_query_info_compound(const unsigned int xid, extern int smb2_query_info_compound(const unsigned int xid,
struct cifs_tcon *tcon, struct cifs_tcon *tcon,
__le16 *utf16_path, u32 desired_access, const char *path, u32 desired_access,
u32 class, u32 type, u32 output_len, u32 class, u32 type, u32 output_len,
struct kvec *rsp, int *buftype, struct kvec *rsp, int *buftype,
struct cifs_sb_info *cifs_sb); struct cifs_sb_info *cifs_sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment