aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-08-13 11:15:54 -0400
committerSteve French <sfrench@us.ibm.com>2005-08-13 11:15:54 -0400
commit4a6d87f1db06c9670251d6c72a89319e7d1cbaee (patch)
treeaa21e8220215933742f931a452d7d96839b93c2b
parenta47fd3f5e3a3f970ac1b81643ac56737f97a1fea (diff)
[CIFS] Add missing check for path name allocation failure. Remove four
redundant null pointer checks before cifs_buf_release. Found by coverity analyzer. Signed-off-by: Steve French (sfrench@us.ibm.com)
-rw-r--r--fs/cifs/cifssmb.c24
-rw-r--r--fs/cifs/dir.c6
2 files changed, 14 insertions, 16 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index e555cb5cf493..459320222cf7 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -415,15 +415,16 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
415 if(server->secMode & SECMODE_SIGN_REQUIRED) 415 if(server->secMode & SECMODE_SIGN_REQUIRED)
416 cERROR(1, 416 cERROR(1,
417 ("Server requires /proc/fs/cifs/PacketSigningEnabled")); 417 ("Server requires /proc/fs/cifs/PacketSigningEnabled"));
418 server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); 418 server->secMode &= ~(SECMODE_SIGN_ENABLED |
419 SECMODE_SIGN_REQUIRED);
419 } else if(sign_CIFS_PDUs == 1) { 420 } else if(sign_CIFS_PDUs == 1) {
420 if((server->secMode & SECMODE_SIGN_REQUIRED) == 0) 421 if((server->secMode & SECMODE_SIGN_REQUIRED) == 0)
421 server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); 422 server->secMode &= ~(SECMODE_SIGN_ENABLED |
423 SECMODE_SIGN_REQUIRED);
422 } 424 }
423 425
424 } 426 }
425 if (pSMB) 427 cifs_buf_release(pSMB);
426 cifs_buf_release(pSMB);
427 return rc; 428 return rc;
428} 429}
429 430
@@ -537,9 +538,8 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
537 rc = -ESHUTDOWN; 538 rc = -ESHUTDOWN;
538 } 539 }
539 } 540 }
540 if (pSMB) 541 up(&ses->sesSem)
541 cifs_small_buf_release(pSMB); 542 cifs_small_buf_release(pSMB);
542 up(&ses->sesSem);
543 543
544 /* if session dead then we do not need to do ulogoff, 544 /* if session dead then we do not need to do ulogoff,
545 since server closed smb session, no sense reporting 545 since server closed smb session, no sense reporting
@@ -1796,8 +1796,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
1796 } 1796 }
1797 } 1797 }
1798qreparse_out: 1798qreparse_out:
1799 if (pSMB) 1799 cifs_buf_release(pSMB);
1800 cifs_buf_release(pSMB);
1801 1800
1802 /* Note: On -EAGAIN error only caller can retry on handle based calls 1801 /* Note: On -EAGAIN error only caller can retry on handle based calls
1803 since file handle passed in no longer valid */ 1802 since file handle passed in no longer valid */
@@ -2520,12 +2519,11 @@ findFirstRetry:
2520 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 2519 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2521 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 2520 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
2522 2521
2523 if (rc) {/* BB add logic to retry regular search if Unix search rejected unexpectedly by server */ 2522 if (rc) {/* BB add logic to retry regular search if Unix search
2523 rejected unexpectedly by server */
2524 /* BB Add code to handle unsupported level rc */ 2524 /* BB Add code to handle unsupported level rc */
2525 cFYI(1, ("Error in FindFirst = %d", rc)); 2525 cFYI(1, ("Error in FindFirst = %d", rc));
2526 2526 cifs_buf_release(pSMB);
2527 if (pSMB)
2528 cifs_buf_release(pSMB);
2529 2527
2530 /* BB eventually could optimize out free and realloc of buf */ 2528 /* BB eventually could optimize out free and realloc of buf */
2531 /* for this case */ 2529 /* for this case */
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index c0f20fc09290..c619d45060ce 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -226,7 +226,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
226 } 226 }
227 227
228 if (rc != 0) { 228 if (rc != 0) {
229 cFYI(1,("Create worked but get_inode_info failed with rc = %d", 229 cFYI(1,
230 ("Create worked but get_inode_info failed rc = %d",
230 rc)); 231 rc));
231 } else { 232 } else {
232 direntry->d_op = &cifs_dentry_ops; 233 direntry->d_op = &cifs_dentry_ops;
@@ -303,8 +304,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
303 up(&direntry->d_sb->s_vfs_rename_sem); 304 up(&direntry->d_sb->s_vfs_rename_sem);
304 if(full_path == NULL) 305 if(full_path == NULL)
305 rc = -ENOMEM; 306 rc = -ENOMEM;
306 307 else if (pTcon->ses->capabilities & CAP_UNIX) {
307 if (full_path && (pTcon->ses->capabilities & CAP_UNIX)) {
308 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 308 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
309 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, 309 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
310 mode,(__u64)current->euid,(__u64)current->egid, 310 mode,(__u64)current->euid,(__u64)current->egid,