]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iser-target: Fix connected_handler + teardown flow race
authorSagi Grimberg <sagig@mellanox.com>
Tue, 2 Dec 2014 14:57:26 +0000 (16:57 +0200)
committerJiri Slaby <jslaby@suse.cz>
Thu, 29 Jan 2015 14:44:51 +0000 (15:44 +0100)
commit057c1b286775eb193e04c4da9dde74e6f1852ec3
treef034233d9e6a43e34e9efa7eec152cc61f61f13d
parenta64969e4418b1c13286b50bf912b5dab584aac1f
iser-target: Fix connected_handler + teardown flow race

commit 19e2090fb246ca21b3e569ead51a6a7a1748eadd upstream.

Take isert_conn pointer from cm_id->qp->qp_context. This
will allow us to know that the cm_id context is always
the network portal. This will make the cm_id event check
(connection or network portal) more reliable.

In order to avoid a NULL dereference in cma_id->qp->qp_context
we destroy the qp after we destroy the cm_id (and make the
dereference safe). session stablishment/teardown sequences
can happen in parallel, we should take into account that
connected_handler might race with connection teardown flow.

Also, protect isert_conn->conn_device->active_qps decrement
within the error patch during QP creation failure and the
normal teardown path in isert_connect_release().

Squashed:

iser-target: Decrement completion context active_qps in error flow

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/infiniband/ulp/isert/ib_isert.c