cma_release_port() may be called twice for the same rdma id during
connection shutdown, causing hlist_del() to SEGV.
Orabug:
16750726
Signed-off-by: Chien-Hua Yen <chien.yen@oracle.com>
(cherry picked from commit
cfee888ccacc233d2045a26492ed92a25d468927)
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
static void cma_release_port(struct rdma_id_private *id_priv)
{
- struct rdma_bind_list *bind_list = id_priv->bind_list;
-
- if (!bind_list)
- return;
+ struct rdma_bind_list *bind_list;
mutex_lock(&lock);
+ bind_list = id_priv->bind_list;
+ if (!bind_list) {
+ mutex_unlock(&lock);
+ return;
+ }
hlist_del(&id_priv->node);
+ id_priv->bind_list = NULL;
if (hlist_empty(&bind_list->owners)) {
idr_remove(bind_list->ps, bind_list->port);
kfree(bind_list);