]> Git Repo - linux.git/commitdiff
IB/isert: Fix possible list corruption in CMA handler
authorSaravanan Vajravel <[email protected]>
Tue, 6 Jun 2023 10:25:30 +0000 (03:25 -0700)
committerLeon Romanovsky <[email protected]>
Sun, 11 Jun 2023 17:29:34 +0000 (20:29 +0300)
When ib_isert module receives connection error event, it is
releasing the isert session and removes corresponding list
node but it doesn't take appropriate mutex lock to remove
the list node.  This can lead to linked  list corruption

Fixes: bd3792205aae ("iser-target: Fix pending connections handling in target stack shutdown sequnce")
Signed-off-by: Selvin Xavier <[email protected]>
Signed-off-by: Saravanan Vajravel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Leon Romanovsky <[email protected]>
drivers/infiniband/ulp/isert/ib_isert.c

index b4809d2372506bc444efb6f02900580f132662db..00a7303c8cc60ef111e7c2e0cbc09c3c2be4ff29 100644 (file)
@@ -657,9 +657,13 @@ static int
 isert_connect_error(struct rdma_cm_id *cma_id)
 {
        struct isert_conn *isert_conn = cma_id->qp->qp_context;
+       struct isert_np *isert_np = cma_id->context;
 
        ib_drain_qp(isert_conn->qp);
+
+       mutex_lock(&isert_np->mutex);
        list_del_init(&isert_conn->node);
+       mutex_unlock(&isert_np->mutex);
        isert_conn->cm_id = NULL;
        isert_put_conn(isert_conn);
 
This page took 0.07306 seconds and 4 git commands to generate.