Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | Subject: [PATCH] Add missing rwlock_unlocks in xprt_register |
| 2 | |
| 3 | It looks like in b2c9430f46c4ac848957fb8adaac176a3f6ac03f when svc_run |
| 4 | switched to poll, an early return was added, but the rwlock was not |
| 5 | unlocked. |
| 6 | |
| 7 | I observed that rpcbind built against libtirpc-1.0.1 would handle only |
| 8 | one request before hanging, and tracked it down to a missing |
| 9 | rwlock_unlock here. |
| 10 | |
| 11 | Fixes: b2c9430f46c4 ('Use poll() instead of select() in svc_run()') |
| 12 | |
| 13 | Upstream-Status: Backport |
| 14 | |
| 15 | Signed-off-by: Michael Forney <mforney@mforney.org> |
| 16 | Signed-off-by: Steve Dickson <steved@redhat.com> |
| 17 | Signed-off-by: Maxin B. John <maxin.john@intel.com> |
| 18 | --- |
| 19 | src/svc.c | 7 ++++--- |
| 20 | 1 file changed, 4 insertions(+), 3 deletions(-) |
| 21 | |
| 22 | diff --git a/src/svc.c b/src/svc.c |
| 23 | index 9c41445..b59467b 100644 |
| 24 | --- a/src/svc.c |
| 25 | +++ b/src/svc.c |
| 26 | @@ -99,7 +99,7 @@ xprt_register (xprt) |
| 27 | { |
| 28 | __svc_xports = (SVCXPRT **) calloc (_rpc_dtablesize(), sizeof (SVCXPRT *)); |
| 29 | if (__svc_xports == NULL) |
| 30 | - return; |
| 31 | + goto unlock; |
| 32 | } |
| 33 | if (sock < _rpc_dtablesize()) |
| 34 | { |
| 35 | @@ -120,14 +120,14 @@ xprt_register (xprt) |
| 36 | svc_pollfd[i].fd = sock; |
| 37 | svc_pollfd[i].events = (POLLIN | POLLPRI | |
| 38 | POLLRDNORM | POLLRDBAND); |
| 39 | - return; |
| 40 | + goto unlock; |
| 41 | } |
| 42 | |
| 43 | new_svc_pollfd = (struct pollfd *) realloc (svc_pollfd, |
| 44 | sizeof (struct pollfd) |
| 45 | * (svc_max_pollfd + 1)); |
| 46 | if (new_svc_pollfd == NULL) /* Out of memory */ |
| 47 | - return; |
| 48 | + goto unlock; |
| 49 | svc_pollfd = new_svc_pollfd; |
| 50 | ++svc_max_pollfd; |
| 51 | |
| 52 | @@ -135,6 +135,7 @@ xprt_register (xprt) |
| 53 | svc_pollfd[svc_max_pollfd - 1].events = (POLLIN | POLLPRI | |
| 54 | POLLRDNORM | POLLRDBAND); |
| 55 | } |
| 56 | +unlock: |
| 57 | rwlock_unlock (&svc_fd_lock); |
| 58 | } |
| 59 | |
| 60 | -- |
| 61 | 2.5.3 |
| 62 | |