diff options
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 8fecc99be344..da2f5446fa7a 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -3892,13 +3892,12 @@ CIFSSMBSetCIFSACL(const int xid, struct cifs_tcon *tcon, __u16 fid, | |||
3892 | int rc = 0; | 3892 | int rc = 0; |
3893 | int bytes_returned = 0; | 3893 | int bytes_returned = 0; |
3894 | SET_SEC_DESC_REQ *pSMB = NULL; | 3894 | SET_SEC_DESC_REQ *pSMB = NULL; |
3895 | NTRANSACT_RSP *pSMBr = NULL; | 3895 | void *pSMBr; |
3896 | 3896 | ||
3897 | setCifsAclRetry: | 3897 | setCifsAclRetry: |
3898 | rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, | 3898 | rc = smb_init(SMB_COM_NT_TRANSACT, 19, tcon, (void **) &pSMB, &pSMBr); |
3899 | (void **) &pSMBr); | ||
3900 | if (rc) | 3899 | if (rc) |
3901 | return (rc); | 3900 | return rc; |
3902 | 3901 | ||
3903 | pSMB->MaxSetupCount = 0; | 3902 | pSMB->MaxSetupCount = 0; |
3904 | pSMB->Reserved = 0; | 3903 | pSMB->Reserved = 0; |
@@ -3926,9 +3925,8 @@ setCifsAclRetry: | |||
3926 | pSMB->AclFlags = cpu_to_le32(aclflag); | 3925 | pSMB->AclFlags = cpu_to_le32(aclflag); |
3927 | 3926 | ||
3928 | if (pntsd && acllen) { | 3927 | if (pntsd && acllen) { |
3929 | memcpy((char *) &pSMBr->hdr.Protocol + data_offset, | 3928 | memcpy((char *)pSMBr + offsetof(struct smb_hdr, Protocol) + |
3930 | (char *) pntsd, | 3929 | data_offset, pntsd, acllen); |
3931 | acllen); | ||
3932 | inc_rfc1001_len(pSMB, byte_count + data_count); | 3930 | inc_rfc1001_len(pSMB, byte_count + data_count); |
3933 | } else | 3931 | } else |
3934 | inc_rfc1001_len(pSMB, byte_count); | 3932 | inc_rfc1001_len(pSMB, byte_count); |
@@ -4846,8 +4844,12 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | |||
4846 | max_len = data_end - temp; | 4844 | max_len = data_end - temp; |
4847 | node->node_name = cifs_strndup_from_utf16(temp, max_len, | 4845 | node->node_name = cifs_strndup_from_utf16(temp, max_len, |
4848 | is_unicode, nls_codepage); | 4846 | is_unicode, nls_codepage); |
4849 | if (!node->node_name) | 4847 | if (!node->node_name) { |
4850 | rc = -ENOMEM; | 4848 | rc = -ENOMEM; |
4849 | goto parse_DFS_referrals_exit; | ||
4850 | } | ||
4851 | |||
4852 | ref++; | ||
4851 | } | 4853 | } |
4852 | 4854 | ||
4853 | parse_DFS_referrals_exit: | 4855 | parse_DFS_referrals_exit: |
@@ -5708,7 +5710,8 @@ CIFSSMBSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5708 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 5710 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
5709 | offset = param_offset + params; | 5711 | offset = param_offset + params; |
5710 | 5712 | ||
5711 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 5713 | data_offset = (char *)pSMB + |
5714 | offsetof(struct smb_hdr, Protocol) + offset; | ||
5712 | 5715 | ||
5713 | count = sizeof(FILE_BASIC_INFO); | 5716 | count = sizeof(FILE_BASIC_INFO); |
5714 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5717 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -5977,7 +5980,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5977 | u16 fid, u32 pid_of_opener) | 5980 | u16 fid, u32 pid_of_opener) |
5978 | { | 5981 | { |
5979 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 5982 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
5980 | FILE_UNIX_BASIC_INFO *data_offset; | 5983 | char *data_offset; |
5981 | int rc = 0; | 5984 | int rc = 0; |
5982 | u16 params, param_offset, offset, byte_count, count; | 5985 | u16 params, param_offset, offset, byte_count, count; |
5983 | 5986 | ||
@@ -5999,8 +6002,9 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
5999 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | 6002 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; |
6000 | offset = param_offset + params; | 6003 | offset = param_offset + params; |
6001 | 6004 | ||
6002 | data_offset = (FILE_UNIX_BASIC_INFO *) | 6005 | data_offset = (char *)pSMB + |
6003 | ((char *)(&pSMB->hdr.Protocol) + offset); | 6006 | offsetof(struct smb_hdr, Protocol) + offset; |
6007 | |||
6004 | count = sizeof(FILE_UNIX_BASIC_INFO); | 6008 | count = sizeof(FILE_UNIX_BASIC_INFO); |
6005 | 6009 | ||
6006 | pSMB->MaxParameterCount = cpu_to_le16(2); | 6010 | pSMB->MaxParameterCount = cpu_to_le16(2); |
@@ -6022,7 +6026,7 @@ CIFSSMBUnixSetFileInfo(const int xid, struct cifs_tcon *tcon, | |||
6022 | inc_rfc1001_len(pSMB, byte_count); | 6026 | inc_rfc1001_len(pSMB, byte_count); |
6023 | pSMB->ByteCount = cpu_to_le16(byte_count); | 6027 | pSMB->ByteCount = cpu_to_le16(byte_count); |
6024 | 6028 | ||
6025 | cifs_fill_unix_set_info(data_offset, args); | 6029 | cifs_fill_unix_set_info((FILE_UNIX_BASIC_INFO *)data_offset, args); |
6026 | 6030 | ||
6027 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); | 6031 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
6028 | if (rc) | 6032 | if (rc) |