[haiku-commits] haiku: hrev45756 - src/add-ons/kernel/file_systems/nfs4

  • From: pdziepak@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 13 Jun 2013 11:41:55 +0200 (CEST)

hrev45756 adds 6 changesets to branch 'master'
old head: 69c8011e6e292af79cadf1e8909d2e0c2ddf1d36
new head: 631ceff2948ab67acde824f0e3889a5de8abe149
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=631ceff+%5E69c8011

----------------------------------------------------------------------------

04fa44c: nfs4: Fix CID #1032280: Prevent integer overflow
  
   * Do not increase delay after tenth attempt
   * Cast 1 to bigtime_t before shifting it left

51fb559: nfs4: Fix CID #1032257: ERR_DENIED is expected only when a cookie is 
given

4f5608e: nfs4: Fix CID #1032256: Use 4kB block size if server reports invalid 
value

5691cd5: nfs4: Use nothrow new when creating CallbackRequest

d94b180: nfs4: Use nothrow new when creating LockInfo

631ceff: nfs4: Fix CID #991493: Release memory when returing an error code

                                    [ Pawel Dziepak <pdziepak@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 14 insertions(+), 6 deletions(-)
src/add-ons/kernel/file_systems/nfs4/Inode.cpp             | 2 +-
src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp        | 7 +++++--
src/add-ons/kernel/file_systems/nfs4/RPCCallbackServer.cpp | 3 ++-
src/add-ons/kernel/file_systems/nfs4/RootInode.cpp         | 8 ++++++--

############################################################################

Commit:      04fa44c37e39953c1bc7b3e488cc9a7663dde56f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=04fa44c
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Jun 13 09:26:30 2013 UTC

Ticket:      https://dev.haiku-os.org/ticket/1032280

nfs4: Fix CID #1032280: Prevent integer overflow

 * Do not increase delay after tenth attempt
 * Cast 1 to bigtime_t before shifting it left

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp 
b/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp
index c7f7827..c07bdd8 100644
--- a/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp
@@ -17,9 +17,9 @@
 static inline bigtime_t
 RetryDelay(uint32 attempt, uint32 leaseTime = 0)
 {
-       attempt = min_c(attempt, sizeof(bigtime_t) * 8);
+       attempt = min_c(attempt, 10);
 
-       bigtime_t delay = (1 << (attempt - 1)) * 100000;
+       bigtime_t delay = (bigtime_t(1) << (attempt - 1)) * 100000;
        if (leaseTime != 0)
                delay = min_c(delay, sSecToBigTime(leaseTime));
        return delay;

############################################################################

Commit:      51fb55934856c1a58b536632297a4aeed38e85ca
URL:         http://cgit.haiku-os.org/haiku/commit/?id=51fb559
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Jun 13 09:28:26 2013 UTC

Ticket:      https://dev.haiku-os.org/ticket/1032257

nfs4: Fix CID #1032257: ERR_DENIED is expected only when a cookie is given

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp 
b/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp
index c07bdd8..c84ccec 100644
--- a/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/NFS4Object.cpp
@@ -60,6 +60,9 @@ NFS4Object::HandleErrors(uint32& attempt, uint32 nfs4Error, 
RPC::Server* server,
 
                // resource is locked, we need to wait
                case NFS4ERR_DENIED:
+                       if (cookie == NULL)
+                               return false;
+
                        if (sequence != NULL)
                                fFileSystem->OpenOwnerSequenceUnlock(*sequence);
 

############################################################################

Commit:      4f5608efd65aed2a60f2d49342899d5aef8f4d33
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4f5608e
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Jun 13 09:31:53 2013 UTC

Ticket:      https://dev.haiku-os.org/ticket/1032256

nfs4: Fix CID #1032256: Use 4kB block size if server reports invalid value

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp 
b/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp
index ed9dee0..73edd0e 100644
--- a/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp
@@ -110,6 +110,8 @@ RootInode::_UpdateInfo(bool force)
 
                if (ioSize == LONGLONG_MAX)
                        ioSize = 32768;
+               if (ioSize == 0)
+                       ioSize = 4096;
                fInfoCache.io_size = ioSize;
                fInfoCache.block_size = ioSize;
                fIOSize = ioSize;

############################################################################

Commit:      5691cd560728b6fd39fb3b1f7d59bd65fcedd0a4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=5691cd5
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Jun 13 09:36:05 2013 UTC

nfs4: Use nothrow new when creating CallbackRequest

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/RPCCallbackServer.cpp 
b/src/add-ons/kernel/file_systems/nfs4/RPCCallbackServer.cpp
index fa371a0..0c44848 100644
--- a/src/add-ons/kernel/file_systems/nfs4/RPCCallbackServer.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/RPCCallbackServer.cpp
@@ -306,7 +306,8 @@ CallbackServer::ConnectionThread(ConnectionEntry* entry)
                        return result;
                }
 
-               CallbackRequest* request = new CallbackRequest(buffer, size);
+               CallbackRequest* request
+                       = new(std::nothrow) CallbackRequest(buffer, size);
                if (request == NULL) {
                        free(buffer);
                        continue;       

############################################################################

Commit:      d94b1808ec0146dcbc7254685a2054c95fbf9d9a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d94b180
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Jun 13 09:37:01 2013 UTC

nfs4: Use nothrow new when creating LockInfo

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/Inode.cpp 
b/src/add-ons/kernel/file_systems/nfs4/Inode.cpp
index be69f68..9e2f687 100644
--- a/src/add-ons/kernel/file_systems/nfs4/Inode.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/Inode.cpp
@@ -749,7 +749,7 @@ Inode::AcquireLock(OpenFileCookie* cookie, const struct 
flock* lock,
        if (owner == NULL)
                return B_NO_MEMORY;
 
-       LockInfo* linfo = new LockInfo(owner);
+       LockInfo* linfo = new(std::nothrow) LockInfo(owner);
        if (linfo == NULL)
                return B_NO_MEMORY;
        locker.Unlock();

############################################################################

Revision:    hrev45756
Commit:      631ceff2948ab67acde824f0e3889a5de8abe149
URL:         http://cgit.haiku-os.org/haiku/commit/?id=631ceff
Author:      Pawel Dziepak <pdziepak@xxxxxxxxxxx>
Date:        Thu Jun 13 09:38:44 2013 UTC

Ticket:      https://dev.haiku-os.org/ticket/991493

nfs4: Fix CID #991493: Release memory when returing an error code

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp 
b/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp
index 73edd0e..24443e6 100644
--- a/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp
+++ b/src/add-ons/kernel/file_systems/nfs4/RootInode.cpp
@@ -205,10 +205,12 @@ RootInode::GetLocations(AttrValue** attrv)
                result = reply.GetAttr(attrv, &count);
                if (result != B_OK)
                        return result;
-               if (count < 1)
+               if (count < 1) {
+                       delete *attrv;
                        return B_ERROR;
-               return B_OK;
+               }
 
+               return B_OK;
        } while (true);
 
        return B_OK;


Other related posts:

  • » [haiku-commits] haiku: hrev45756 - src/add-ons/kernel/file_systems/nfs4 - pdziepak