pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client: Patches for nfs_mount crash+misc, 2025-03-08
Posted by Anonymous on Sat 8th Mar 2025 20:10
raw | new post

  1. From 9b690c7cdbccbe30812bbe00a133b894d0ba56ce Mon Sep 17 00:00:00 2001
  2. From: Dan Shelton <dan.f.shelton@gmail.com>
  3. Date: Fri, 7 Mar 2025 11:50:04 +0100
  4. Subject: [PATCH 1/4] daemon: Fix ReactOS clang warning
  5.  
  6. Fix ReactOS clang warning
  7.  
  8. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  9. ---
  10. daemon/nfs41_ops.c | 4 ++--
  11.  1 file changed, 2 insertions(+), 2 deletions(-)
  12.  
  13. diff --git a/daemon/nfs41_ops.c b/daemon/nfs41_ops.c
  14. index 9302744..2ffaaeb 100644
  15. --- a/daemon/nfs41_ops.c
  16. +++ b/daemon/nfs41_ops.c
  17. @@ -1520,8 +1520,8 @@ int nfs41_setattr(
  18.  
  19.      if (((setattr_res.attrsset.count > 0) &&
  20.              (setattr_res.attrsset.arr[0] & FATTR4_WORD0_SIZE)) ||
  21. -        (setattr_res.attrsset.count > 1) &&
  22. -            (setattr_res.attrsset.arr[1] & FATTR4_WORD1_SPACE_USED))
  23. +        ((setattr_res.attrsset.count > 1) &&
  24. +            (setattr_res.attrsset.arr[1] & FATTR4_WORD1_SPACE_USED)))
  25.          nfs41_superblock_space_changed(file->fh.superblock);
  26.  out:
  27.      return status;
  28. --
  29. 2.45.1
  30.  
  31. From f9c869abc8eb303458b07a1297615a376634eaa8 Mon Sep 17 00:00:00 2001
  32. From: Roland Mainz <roland.mainz@nrubsig.org>
  33. Date: Sat, 8 Mar 2025 20:35:14 +0100
  34. Subject: [PATCH 2/4] mount: nfs_mount |EnumMounts()| can crash if |lpProvider
  35.  == NULL|
  36.  
  37. nfs_mount |EnumMounts()| can crash if |lpProvider == NULL|.
  38.  
  39. Reported-by: Dan Shelton <dan.f.shelton@gmail.com>
  40. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  41. ---
  42. mount/enum.c | 3 +++
  43.  1 file changed, 3 insertions(+)
  44.  
  45. diff --git a/mount/enum.c b/mount/enum.c
  46. index 5e30329..455b888 100644
  47. --- a/mount/enum.c
  48. +++ b/mount/enum.c
  49. @@ -262,6 +262,9 @@ DWORD EnumMounts(
  50.          {
  51.              for (i = 0; i < dwCount; i++)
  52.              {
  53. +                if (pResources[i].lpProvider == NULL)
  54. +                    continue;
  55. +
  56.                  if (!wcscmp(pResources[i].lpProvider,
  57.                      NFS41_PROVIDER_NAME_U))
  58.                  {
  59. --
  60. 2.45.1
  61.  
  62. From 0acd5119c907911b9182b9ffddfefcdfb153152b Mon Sep 17 00:00:00 2001
  63. From: Roland Mainz <roland.mainz@nrubsig.org>
  64. Date: Sat, 8 Mar 2025 20:37:01 +0100
  65. Subject: [PATCH 3/4] dll: Fix |signed|/|unsigned| and |INT|/|ULONG| datatype
  66.  mixing
  67.  
  68. Fix |signed|/|unsigned| and |INT|/|ULONG| datatype mixing.
  69.  
  70. Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
  71. ---
  72. dll/nfs41_np.c | 21 +++++++++++----------
  73.  dll/nfs41_np.h |  4 ++--
  74.  2 files changed, 13 insertions(+), 12 deletions(-)
  75.  
  76. diff --git a/dll/nfs41_np.c b/dll/nfs41_np.c
  77. index cb1148c..0943164 100644
  78. --- a/dll/nfs41_np.c
  79. +++ b/dll/nfs41_np.c
  80. @@ -267,7 +267,7 @@ static DWORD StoreConnectionInfo(
  81.      HANDLE hMutex, hMemory;
  82.      PNFS41NP_SHARED_MEMORY pSharedMemory;
  83.      PNFS41NP_NETRESOURCE pNfs41NetResource;
  84. -    INT i;
  85. +    ULONG i;
  86.      bool FreeEntryFound = false;
  87.  #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  88.      LUID authenticationid = { .LowPart = 0, .HighPart = 0L };
  89. @@ -453,7 +453,7 @@ NPGetCaps(
  90.                   WNNC_CON_ADDCONNECTION3;
  91.              break;
  92.          case WNNC_ENUMERATION:
  93. -            rc = WNNC_ENUM_LOCAL;
  94. +            rc = WNNC_ENUM_CONTEXT;
  95.              break;
  96.          case WNNC_START:
  97.              rc = 1;
  98. @@ -805,7 +805,7 @@ NPCancelConnection(
  99.      if (Status != WN_SUCCESS)
  100.          goto out;
  101.  
  102. -    INT  Index;
  103. +    ULONG Index;
  104.      PNFS41NP_NETRESOURCE pNetResource;
  105.      Status = WN_NOT_CONNECTED;
  106.  
  107. @@ -945,7 +945,7 @@ DWORD is_unc_path_mounted(
  108.      if (Status != WN_SUCCESS)
  109.          goto out;
  110.  
  111. -    INT  Index;
  112. +    ULONG Index;
  113.      PNFS41NP_NETRESOURCE pNetResource;
  114.      PNFS41NP_NETRESOURCE foundNetResource = NULL;
  115.  #ifdef NFS41_DRIVER_SYSTEM_LUID_MOUNTS_ARE_GLOBAL
  116. @@ -1073,7 +1073,7 @@ NPGetConnection3(
  117.      if (Status != WN_SUCCESS)
  118.          goto out;
  119.  
  120. -    INT  Index;
  121. +    ULONG Index;
  122.      PNFS41NP_NETRESOURCE pNetResource;
  123.      PNFS41NP_NETRESOURCE foundNetResource = NULL;
  124.  #ifdef NFS41_DRIVER_SYSTEM_LUID_MOUNTS_ARE_GLOBAL
  125. @@ -1213,14 +1213,14 @@ NPEnumResource(
  126.      HANDLE  hMutex, hMemory;
  127.      PNFS41NP_SHARED_MEMORY  pSharedMemory;
  128.      PNFS41NP_NETRESOURCE pNfsNetResource;
  129. -    INT             Index = *(PULONG)hEnum;
  130. +    ULONG           Index = *((PULONG)hEnum);
  131.  #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  132.      LUID            authenticationid =
  133.          { .LowPart = 0, .HighPart = 0L };
  134.  #endif /* NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE */
  135.  
  136. -    DbgP((L"--> NPEnumResource(hEnum=0x%x, *lpcCount=%d)\n",
  137. -        HANDLE2INT(hEnum), (int)*lpcCount));
  138. +    DbgP((L"--> NPEnumResource(hEnum=0x%x, *lpcCount=%lu)\n",
  139. +        HANDLE2INT(hEnum), (unsigned long)*lpcCount));
  140.  
  141.  #ifdef NFS41_DRIVER_USE_AUTHENTICATIONID_FOR_MOUNT_NAMESPACE
  142.      (void)get_token_authenticationid(GetCurrentThreadEffectiveToken(),
  143. @@ -1319,9 +1319,10 @@ NPEnumResource(
  144.      CloseSharedMemory(&hMutex, &hMemory, (PVOID*)&pSharedMemory);
  145.  out:
  146.      *lpcCount = EntriesCopied;
  147. -    *(PULONG) hEnum = Index;
  148. +    *((PULONG)hEnum) = Index;
  149.  
  150. -    DbgP((L"<-- NPEnumResource returns: %d\n", (int)EntriesCopied));
  151. +    DbgP((L"<-- NPEnumResource returns: %d, Index=%lu\n",
  152. +        (int)EntriesCopied, (unsigned long)Index));
  153.  
  154.      return Status;
  155.  }
  156. diff --git a/dll/nfs41_np.h b/dll/nfs41_np.h
  157. index d9089a4..eb563fe 100644
  158. --- a/dll/nfs41_np.h
  159. +++ b/dll/nfs41_np.h
  160. @@ -57,8 +57,8 @@ typedef struct __NFS41NP_NETRESOURCE {
  161.  } NFS41NP_NETRESOURCE, *PNFS41NP_NETRESOURCE;
  162.  
  163.  typedef struct __NFS41NP_SHARED_MEMORY {
  164. -    INT                 NextAvailableIndex;
  165. -    INT                 NumberOfResourcesInUse;
  166. +    ULONG               NextAvailableIndex;
  167. +    ULONG               NumberOfResourcesInUse;
  168.      NFS41NP_NETRESOURCE NetResources[NFS41NP_MAX_DEVICES];
  169.  } NFS41NP_SHARED_MEMORY, *PNFS41NP_SHARED_MEMORY;
  170.  
  171. --
  172. 2.45.1

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at