From eae59391d42fc62a1790bad6abf914274720f81c Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Thu, 4 Feb 2010 16:28:28 -0800 Subject: [PATCH] dapl: avoid accessing cm_ptr after queuing to cr_thread It's possible that once a cm_ptr has been added to the hca list, that the cr_thread can remove it from the list and process it or delete it. To avoid any potential issue, do not reference the cm_ptr after placing it on the hca list. Signed-off-by: Sean Hefty --- trunk/ulp/dapl2/dapl/openib_scm/cm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/trunk/ulp/dapl2/dapl/openib_scm/cm.c b/trunk/ulp/dapl2/dapl/openib_scm/cm.c index 00995f0f..1d7a8dc4 100644 --- a/trunk/ulp/dapl2/dapl/openib_scm/cm.c +++ b/trunk/ulp/dapl2/dapl/openib_scm/cm.c @@ -391,15 +391,17 @@ notify_thread: /* queue socket for processing CM work */ static void dapli_cm_queue(struct ib_cm_handle *cm_ptr) { + DAPL_HCA *hca_ptr = cm_ptr->hca; + /* add to work queue for cr thread processing */ dapl_llist_init_entry((DAPL_LLIST_ENTRY *) & cm_ptr->entry); - dapl_os_lock(&cm_ptr->hca->ib_trans.lock); - dapl_llist_add_tail(&cm_ptr->hca->ib_trans.list, + dapl_os_lock(&hca->ib_trans.lock); + dapl_llist_add_tail(&hca->ib_trans.list, (DAPL_LLIST_ENTRY *) & cm_ptr->entry, cm_ptr); - dapl_os_unlock(&cm_ptr->hca->ib_trans.lock); + dapl_os_unlock(&hca->ib_trans.lock); /* wakeup CM work thread */ - send(cm_ptr->hca->ib_trans.scm[1], "w", sizeof "w", 0); + send(hca->ib_trans.scm[1], "w", sizeof "w", 0); } /* -- 2.46.0