Keep the ib_srpt session as long as srpt_close_session() may access it. Signed-off-by: Bart Van Assche <bart.vanass...@sandisk.com> Cc: Christoph Hellwig <h...@lst.de> --- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 669ae5c..7548bd5 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2228,6 +2228,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, pr_debug("Establish connection sess=%p name=%s cm_id=%p\n", ch->sess, ch->sess_name, ch->cm_id); + kref_get(&ch->kref); + /* create srp_login_response */ rsp->opcode = SRP_LOGIN_RSP; rsp->tag = req->tag; @@ -2991,6 +2993,8 @@ static void srpt_close_session(struct se_session *se_sess) srpt_disconnect_ch(ch); + kref_put(&ch->kref, srpt_free_ch); + if (!wait) return; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html