aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 986709a8d90..602f77c304c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -773,10 +773,11 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid)
773 cifs_dump_mem("Bad SMB: ", buf, 773 cifs_dump_mem("Bad SMB: ", buf,
774 min_t(unsigned int, server->total_read, 48)); 774 min_t(unsigned int, server->total_read, 48));
775 775
776 if (mid) 776 if (!mid)
777 handle_mid(mid, server, smb_buffer, length); 777 return length;
778 778
779 return length; 779 handle_mid(mid, server, smb_buffer, length);
780 return 0;
780} 781}
781 782
782static int 783static int
@@ -2125,7 +2126,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2125 down_read(&key->sem); 2126 down_read(&key->sem);
2126 upayload = key->payload.data; 2127 upayload = key->payload.data;
2127 if (IS_ERR_OR_NULL(upayload)) { 2128 if (IS_ERR_OR_NULL(upayload)) {
2128 rc = PTR_ERR(key); 2129 rc = upayload ? PTR_ERR(upayload) : -EINVAL;
2129 goto out_key_put; 2130 goto out_key_put;
2130 } 2131 }
2131 2132
@@ -2142,14 +2143,14 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2142 2143
2143 len = delim - payload; 2144 len = delim - payload;
2144 if (len > MAX_USERNAME_SIZE || len <= 0) { 2145 if (len > MAX_USERNAME_SIZE || len <= 0) {
2145 cFYI(1, "Bad value from username search (len=%ld)", len); 2146 cFYI(1, "Bad value from username search (len=%zd)", len);
2146 rc = -EINVAL; 2147 rc = -EINVAL;
2147 goto out_key_put; 2148 goto out_key_put;
2148 } 2149 }
2149 2150
2150 vol->username = kstrndup(payload, len, GFP_KERNEL); 2151 vol->username = kstrndup(payload, len, GFP_KERNEL);
2151 if (!vol->username) { 2152 if (!vol->username) {
2152 cFYI(1, "Unable to allocate %ld bytes for username", len); 2153 cFYI(1, "Unable to allocate %zd bytes for username", len);
2153 rc = -ENOMEM; 2154 rc = -ENOMEM;
2154 goto out_key_put; 2155 goto out_key_put;
2155 } 2156 }
@@ -2157,7 +2158,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2157 2158
2158 len = key->datalen - (len + 1); 2159 len = key->datalen - (len + 1);
2159 if (len > MAX_PASSWORD_SIZE || len <= 0) { 2160 if (len > MAX_PASSWORD_SIZE || len <= 0) {
2160 cFYI(1, "Bad len for password search (len=%ld)", len); 2161 cFYI(1, "Bad len for password search (len=%zd)", len);
2161 rc = -EINVAL; 2162 rc = -EINVAL;
2162 kfree(vol->username); 2163 kfree(vol->username);
2163 vol->username = NULL; 2164 vol->username = NULL;
@@ -2167,7 +2168,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
2167 ++delim; 2168 ++delim;
2168 vol->password = kstrndup(delim, len, GFP_KERNEL); 2169 vol->password = kstrndup(delim, len, GFP_KERNEL);
2169 if (!vol->password) { 2170 if (!vol->password) {
2170 cFYI(1, "Unable to allocate %ld bytes for password", len); 2171 cFYI(1, "Unable to allocate %zd bytes for password", len);
2171 rc = -ENOMEM; 2172 rc = -ENOMEM;
2172 kfree(vol->username); 2173 kfree(vol->username);
2173 vol->username = NULL; 2174 vol->username = NULL;
@@ -3857,10 +3858,8 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
3857 struct smb_vol *vol_info; 3858 struct smb_vol *vol_info;
3858 3859
3859 vol_info = kzalloc(sizeof(*vol_info), GFP_KERNEL); 3860 vol_info = kzalloc(sizeof(*vol_info), GFP_KERNEL);
3860 if (vol_info == NULL) { 3861 if (vol_info == NULL)
3861 tcon = ERR_PTR(-ENOMEM); 3862 return ERR_PTR(-ENOMEM);
3862 goto out;
3863 }
3864 3863
3865 vol_info->local_nls = cifs_sb->local_nls; 3864 vol_info->local_nls = cifs_sb->local_nls;
3866 vol_info->linux_uid = fsuid; 3865 vol_info->linux_uid = fsuid;