Commit 0d6be9f4 authored by Steve French's avatar Steve French Committed by Steve French

[CIFS] misc kmalloc and kernel_thread failure checks

Signed-off-by: Steve French (sfrench@us.ibm.com)
parent 2143edbc
......@@ -153,7 +153,7 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_
wchar_t * unicode_buf;
unsigned int i,user_name_len,dom_name_len;
if(ses)
if(ses == NULL)
return -EINVAL;
E_md4hash(ses->password, temp_hash);
......@@ -167,7 +167,13 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_
return -EINVAL;
ucase_buf = kmalloc((MAX_USERNAME_SIZE+1), GFP_KERNEL);
if(ucase_buf == NULL)
return -ENOMEM;
unicode_buf = kmalloc((MAX_USERNAME_SIZE+1)*4, GFP_KERNEL);
if(unicode_buf == NULL) {
kfree(ucase_buf);
return -ENOMEM;
}
for(i=0;i<user_name_len;i++)
ucase_buf[i] = nls_info->charset2upper[(int)ses->userName[i]];
......
......@@ -756,11 +756,14 @@ init_cifs(void)
if (!rc) {
rc = register_filesystem(&cifs_fs_type);
if (!rc) {
kernel_thread(cifs_oplock_thread, NULL,
rc = (int)kernel_thread(cifs_oplock_thread, NULL,
CLONE_FS | CLONE_FILES | CLONE_VM);
return rc; /* Success */
} else
cifs_destroy_request_bufs();
if(rc > 0)
return 0;
else
cERROR(1,("error %d create oplock thread",rc));
}
cifs_destroy_request_bufs();
}
cifs_destroy_mids();
}
......
......@@ -1314,8 +1314,19 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
so no need to spinlock this init of tcpStatus */
srvTcp->tcpStatus = CifsNew;
init_MUTEX(&srvTcp->tcpSem);
kernel_thread((void *)(void *)cifs_demultiplex_thread, srvTcp,
rc = (int)kernel_thread((void *)(void *)cifs_demultiplex_thread, srvTcp,
CLONE_FS | CLONE_FILES | CLONE_VM);
if(rc < 0) {
rc = -ENOMEM;
sock_release(csocket);
if(volume_info.UNC)
kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password);
FreeXid(xid);
return rc;
} else
rc = 0;
memcpy(srvTcp->workstation_RFC1001_name, volume_info.source_rfc1001_name,16);
}
}
......
......@@ -201,6 +201,8 @@ cifs_get_inode_info(struct inode **pinode, const unsigned char *search_path,
/* if file info not passed in then get it from server */
if(pfindData == NULL) {
buf = kmalloc(sizeof(FILE_ALL_INFO),GFP_KERNEL);
if(buf == NULL)
return -ENOMEM;
pfindData = (FILE_ALL_INFO *)buf;
/* could do find first instead but this returns more info */
rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData,
......
......@@ -297,10 +297,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
if(referrals)
kfree(referrals);
kfree(tmp_path);
if(referrals) {
kfree(referrals);
}
}
}
/* BB add code like else decode referrals then memcpy to
tmpbuffer and free referrals string array BB */
}
......
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