Commit 8f2376ad authored by Cyril Gorcunov's avatar Cyril Gorcunov Committed by Steve French

[CIFS] Fix endian conversion problem in posix mkdir

Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 516897a2
...@@ -9,7 +9,8 @@ ability to mount to IPC$ share (which allows CIFS named pipes to be ...@@ -9,7 +9,8 @@ ability to mount to IPC$ share (which allows CIFS named pipes to be
opened, read and written as if they were files). When 1st tree opened, read and written as if they were files). When 1st tree
connect fails (e.g. due to signing negotiation failure) fix connect fails (e.g. due to signing negotiation failure) fix
leak that causes cifsd not to stop and rmmod to fail to cleanup leak that causes cifsd not to stop and rmmod to fail to cleanup
cifs_request_buffers pool. cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on
bigendian architectures.
Version 1.50 Version 1.50
------------ ------------
......
...@@ -51,8 +51,8 @@ struct cifs_acl { ...@@ -51,8 +51,8 @@ struct cifs_acl {
struct cifs_ntace { /* first part of ACE which contains perms */ struct cifs_ntace { /* first part of ACE which contains perms */
__u8 type; __u8 type;
__u8 flags; __u8 flags;
__u16 size; __le16 size;
__u32 access_req; __le32 access_req;
} __attribute__((packed)); } __attribute__((packed));
struct cifs_ace { /* last part of ACE which includes user info */ struct cifs_ace { /* last part of ACE which includes user info */
......
...@@ -345,7 +345,7 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, ...@@ -345,7 +345,7 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses,
user = kmalloc(2 + (len * 2), GFP_KERNEL); user = kmalloc(2 + (len * 2), GFP_KERNEL);
if (user == NULL) if (user == NULL)
goto calc_exit_2; goto calc_exit_2;
len = cifs_strtoUCS(user, ses->userName, len, nls_cp); len = cifs_strtoUCS((__le16 *)user, ses->userName, len, nls_cp);
UniStrupr(user); UniStrupr(user);
hmac_md5_update((char *)user, 2*len, pctxt); hmac_md5_update((char *)user, 2*len, pctxt);
...@@ -356,7 +356,8 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, ...@@ -356,7 +356,8 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses,
domain = kmalloc(2 + (len * 2), GFP_KERNEL); domain = kmalloc(2 + (len * 2), GFP_KERNEL);
if (domain == NULL) if (domain == NULL)
goto calc_exit_1; goto calc_exit_1;
len = cifs_strtoUCS(domain, ses->domainName, len, nls_cp); len = cifs_strtoUCS((__le16 *)domain, ses->domainName, len,
nls_cp);
/* the following line was removed since it didn't work well /* the following line was removed since it didn't work well
with lower cased domain name that passed as an option. with lower cased domain name that passed as an option.
Maybe converting the domain name earlier makes sense */ Maybe converting the domain name earlier makes sense */
......
...@@ -1069,7 +1069,7 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, ...@@ -1069,7 +1069,7 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags,
InformationLevel) - 4; InformationLevel) - 4;
offset = param_offset + params; offset = param_offset + params;
pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset); pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset);
pdata->Level = SMB_QUERY_FILE_UNIX_BASIC; pdata->Level = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
pdata->Permissions = cpu_to_le64(mode); pdata->Permissions = cpu_to_le64(mode);
pdata->PosixOpenFlags = cpu_to_le32(posix_flags); pdata->PosixOpenFlags = cpu_to_le32(posix_flags);
pdata->OpenFlags = cpu_to_le32(*pOplock); pdata->OpenFlags = cpu_to_le32(*pOplock);
...@@ -1115,8 +1115,8 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, ...@@ -1115,8 +1115,8 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags,
if (cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction) if (cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction)
*pOplock |= CIFS_CREATE_ACTION; *pOplock |= CIFS_CREATE_ACTION;
/* check to make sure response data is there */ /* check to make sure response data is there */
if (psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) { if (psx_rsp->ReturnedLevel != cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC)) {
pRetData->Type = -1; /* unknown */ pRetData->Type = cpu_to_le32(-1); /* unknown */
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
cFYI(1, ("unknown type")); cFYI(1, ("unknown type"));
#endif #endif
...@@ -1124,7 +1124,7 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags, ...@@ -1124,7 +1124,7 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags,
if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP)
+ sizeof(FILE_UNIX_BASIC_INFO)) { + sizeof(FILE_UNIX_BASIC_INFO)) {
cERROR(1, ("Open response data too small")); cERROR(1, ("Open response data too small"));
pRetData->Type = -1; pRetData->Type = cpu_to_le32(-1);
goto psx_create_err; goto psx_create_err;
} }
memcpy((char *) pRetData, memcpy((char *) pRetData,
......
...@@ -947,7 +947,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) ...@@ -947,7 +947,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
d_drop(direntry); d_drop(direntry);
} else { } else {
int obj_type; int obj_type;
if (pInfo->Type == -1) /* no return info - go query */ { if (pInfo->Type == cpu_to_le32(-1)) {
/* no return info, go query for it */
kfree(pInfo); kfree(pInfo);
goto mkdir_get_info; goto mkdir_get_info;
} }
......
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