about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS18
-rw-r--r--sunrpc/bindrsvprt.c11
3 files changed, 25 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 63e00edcb1..8f2f6d221c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-11-19  Peng Haitao  <penght@cn.fujitsu.com>
+
+	[BZ #13763]
+	* sunrpc/bindrsvprt.c: Add lock to protect static variable.
+
 2012-11-19  Steve McIntyre  <steve.mcintyre@linaro.org>
 
 	* sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB64): New macro.
diff --git a/NEWS b/NEWS
index 6e8c6c28d6..d3e64c40d8 100644
--- a/NEWS
+++ b/NEWS
@@ -12,15 +12,15 @@ Version 2.17
   1349, 3439, 3479, 3665, 5044, 5246, 5298, 5400, 6530, 6778, 6808, 9685,
   9914, 10014, 10038, 10631, 10873, 11438, 11607, 11638, 11741, 12140,
   13412, 13542, 13601, 13603, 13604, 13629, 13679, 13696, 13698, 13717,
-  13741, 13939, 13950, 13952, 13966, 14042, 14047, 14090, 14150, 14151,
-  14152, 14154, 14157, 14166, 14173, 14195, 14237, 14251, 14252, 14283,
-  14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14368,
-  14376, 14417, 14459, 14476, 14477, 14501, 14505, 14510, 14516, 14518,
-  14519, 14530, 14532, 14538, 14543, 14544, 14545, 14557, 14562, 14568,
-  14576, 14579, 14583, 14587, 14595, 14602, 14610, 14621, 14638, 14645,
-  14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694, 14716, 14743,
-  14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14805, 14807,
-  14809, 14811, 14815, 14821, 14824, 14828, 14831, 14838.
+  13741, 13763, 13939, 13950, 13952, 13966, 14042, 14047, 14090, 14150,
+  14151, 14152, 14154, 14157, 14166, 14173, 14195, 14237, 14251, 14252,
+  14283, 14298, 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349,
+  14368, 14376, 14417, 14459, 14476, 14477, 14501, 14505, 14510, 14516,
+  14518, 14519, 14530, 14532, 14538, 14543, 14544, 14545, 14557, 14562,
+  14568, 14576, 14579, 14583, 14587, 14595, 14602, 14610, 14621, 14638,
+  14645, 14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694, 14716,
+  14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14805,
+  14807, 14809, 14811, 14815, 14821, 14824, 14828, 14831, 14838.
 
 * Port to ARM AArch64 contributed by Linaro.
 
diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c
index d493c9f23e..e6a1b0b0b3 100644
--- a/sunrpc/bindrsvprt.c
+++ b/sunrpc/bindrsvprt.c
@@ -35,6 +35,12 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <bits/libc-lock.h>
+
+/*
+ * Locks the static variables in this file.
+ */
+__libc_lock_define_initialized (static, lock);
 
 /*
  * Bind a socket to a privileged IP port
@@ -74,6 +80,9 @@ bindresvport (int sd, struct sockaddr_in *sin)
 
   int nports = ENDPORT - startport + 1;
   int endport = ENDPORT;
+
+  __libc_lock_lock (lock);
+
  again:
   for (i = 0; i < nports; ++i)
     {
@@ -94,6 +103,8 @@ bindresvport (int sd, struct sockaddr_in *sin)
       goto again;
     }
 
+  __libc_lock_unlock (lock);
+
   return res;
 }
 libc_hidden_def (bindresvport)