From efc5d0ec9c1ebade5ddfe673ff1f42be80288b7d Mon Sep 17 00:00:00 2001 From: Pranav Mahesh Phansalkar Date: Tue, 30 Dec 2025 22:22:07 +0530 Subject: [PATCH] qcci: Remove client lock around xport close in release_async In qmi_client_release_async(), only hold clnt->lock long enough to mark non-notifier clients as not accepting transactions, clean up pending transactions, save the release callback, and clear clnt->xport_handle. Call xport->ops->close() after dropping clnt->lock using the saved xport_handle. Moving xport->close() out of the client lock avoids a lock ordering inversion with the control thread, which can hold xport_list_lock while invoking CCI callbacks during transport teardown. Signed-off-by: Pranav Mahesh Phansalkar --- qcci/qcci_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qcci/qcci_common.c b/qcci/qcci_common.c index 1f73370..de1d57d 100644 --- a/qcci/qcci_common.c +++ b/qcci/qcci_common.c @@ -2071,6 +2071,7 @@ qmi_cci_error_type qmi_cci_release_async( void *release_cb_data) { qcci_client_type *clnt; + void *xport_handle; clnt = qcci_client_get_ref(user_handle, 1); if (!clnt) @@ -2078,6 +2079,7 @@ qmi_cci_error_type qmi_cci_release_async( QCCI_OS_LOCK(&clnt->lock); + xport_handle = clnt->xport_handle; if (clnt->category != QCCI_NOTIFIER_CLIENT) { /* From now on all calls to qcci_send will fail */ clnt->info.client.accepting_txns = 0; @@ -2087,11 +2089,10 @@ qmi_cci_error_type qmi_cci_release_async( clnt->release_cb = release_cb; clnt->release_cb_data = release_cb_data; - - qcci_xport_ops->close(clnt->xport_handle); clnt->xport_handle = NULL; QCCI_OS_UNLOCK(&clnt->lock); + qcci_xport_ops->close(xport_handle); qcci_client_put_ref(clnt);