diff options
author | Steve French <sfrench@us.ibm.com> | 2005-08-13 11:15:54 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-08-13 11:15:54 -0400 |
commit | 4a6d87f1db06c9670251d6c72a89319e7d1cbaee (patch) | |
tree | aa21e8220215933742f931a452d7d96839b93c2b /fs/cifs/cifssmb.c | |
parent | a47fd3f5e3a3f970ac1b81643ac56737f97a1fea (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)
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 24 |
1 files changed, 11 insertions, 13 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 | } |
1798 | qreparse_out: | 1798 | qreparse_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 */ |