diff mbox

[2/3] ibacm: close the provider endpoint when it fails to assign a name to a core endpoint

Message ID 1416408407-6774-3-git-send-email-kaike.wan@intel.com (mailing list archive)
State Rejected
Headers show

Commit Message

Wan, Kaike Nov. 19, 2014, 2:46 p.m. UTC
From: Kaike Wan <kaike.wan@intel.com>

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>
---
 src/acm.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/src/acm.c b/src/acm.c
index 11fda4c..d807c73 100644
--- 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);
 }