Skip to content

Commit fce50a2

Browse files
author
Nicholas Bellinger
committed
iser-target: Avoid isert_conn->cm_id dereference in isert_login_recv_done
This patch fixes a NULL pointer dereference in isert_login_recv_done() of isert_conn->cm_id due to isert_cma_handler() -> isert_connect_error() resetting isert_conn->cm_id = NULL during a failed login attempt. As per Sagi, we will always see the completion of all recv wrs posted on the qp (given that we assigned a ->done handler), this is a FLUSH error completion, we just don't get to verify that because we deref NULL before. The issue here, was the assumption that dereferencing the connection cm_id is always safe, which is not true since: commit 4a579da Author: Sagi Grimberg <[email protected]> Date: Sun Mar 29 15:52:04 2015 +0300 iser-target: Fix possible deadlock in RDMA_CM connection error As I see it, we have a direct reference to the isert_device from isert_conn which is the one-liner fix that we actually need like we do in isert_rdma_read_done() and isert_rdma_write_done(). Reported-by: Andrea Righi <[email protected]> Tested-by: Andrea Righi <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Cc: <[email protected]> # 3.10+ Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 5821783 commit fce50a2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ static void
14521452
isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc)
14531453
{
14541454
struct isert_conn *isert_conn = wc->qp->qp_context;
1455-
struct ib_device *ib_dev = isert_conn->cm_id->device;
1455+
struct ib_device *ib_dev = isert_conn->device->ib_device;
14561456

14571457
if (unlikely(wc->status != IB_WC_SUCCESS)) {
14581458
isert_print_wc(wc, "login recv");

0 commit comments

Comments
 (0)