diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2018-07-05 15:02:06 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-07-11 03:11:45 +0000 |
commit | e31c7a7c0c1ea3f6e931935226fb976a92779ba7 (patch) | |
tree | 682ee4aebec82b10e8c3999d0d4fbb7229d1b8af /rpc | |
parent | f4497ee445213650df3509f2d0b682a6455d7305 (diff) |
changelog: fix br-state-check.t crash for brick_mux
Problem: br-state-check.t is getting crash
Solution: Check condition in rpcsvc_request_create
before allocate memory from rxpool
BUG: 1597776
Change-Id: I4fde1ade6073f603c32453f1840395db9a9155b7
fixes: bz#1597776
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index 2c7a3be8307..01847e6c5ad 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -458,7 +458,7 @@ rpcsvc_request_create (rpcsvc_t *svc, rpc_transport_t *trans, size_t msglen = 0; int ret = -1; - if (!svc || !trans) + if (!svc || !trans || !svc->rxpool) return NULL; /* We need to allocate the request before actually calling @@ -1585,6 +1585,7 @@ rpcsvc_get_listener (rpcsvc_t *svc, uint16_t port, rpc_transport_t *trans) { rpcsvc_listener_t *listener = NULL; char found = 0; + rpcsvc_listener_t *next = NULL; uint32_t listener_port = 0; if (!svc) { @@ -1593,7 +1594,7 @@ rpcsvc_get_listener (rpcsvc_t *svc, uint16_t port, rpc_transport_t *trans) pthread_rwlock_rdlock (&svc->rpclock); { - list_for_each_entry (listener, &svc->listeners, list) { + list_for_each_entry_safe (listener, next, &svc->listeners, list) { if (trans != NULL) { if (listener->trans == trans) { found = 1; |