]> git.openfabrics.org - ~shefty/ibacm.git/commitdiff
ibacm: close the provider endpoint when it fails to assign a name to a core endpoint
authorKaike Wan <kaike.wan@intel.com>
Wed, 3 Dec 2014 19:37:51 +0000 (11:37 -0800)
committerSean Hefty <sean.hefty@intel.com>
Wed, 3 Dec 2014 19:43:30 +0000 (11:43 -0800)
In function acm_ep_up(), when it fails to assign any name to an endpoint, the
endpoint in the provider is not properly closed before the core endpoint is
freed. This may cause segfault when ibacmp tries to join multicast group with
a stale core endpoint pointer.

Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/acm.c

index 11fda4cd74299de951ee9e714900217d95cb577a..d807c73ec3397ba79908b90fab43ad17cb99785c 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -1744,12 +1744,15 @@ static void acm_ep_up(struct acmc_port *port, uint16_t pkey)
        ret = acm_assign_ep_names(ep);
        if (ret) {
                acm_log(0, "ERROR - unable to assign EP name for pkey 0x%x\n", pkey);
-               goto err;
+               goto ep_close;
        }
 
        DListInsertHead(&ep->entry, &port->ep_list);
        return;
 
+ep_close:
+       port->prov->close_endpoint(ep->prov_ep_context);
+
 err:
        free(ep);
 }