isert: fix cleaning isert_con_dev

Clean pointers not to point to invalid memory.
- While conn is released set conn_dev->conn to null as conn is invalid now.
- While conn_dev is released set priv(conn) to null as conn_dev is invalid now.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6935 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Israel Rukshin
2016-08-17 07:27:06 +00:00
parent 583f452957
commit c3827a6f54
2 changed files with 7 additions and 8 deletions

View File

@@ -1279,8 +1279,12 @@ static void isert_kref_free(struct kref *kref)
isert_conn->cm_id = NULL;
dev = isert_get_priv(&isert_conn->iscsi);
if (dev)
if (dev) {
isert_del_timer(dev);
set_bit(ISERT_CONN_PASSED, &dev->flags);
dev->conn = NULL;
dev->state = CS_DISCONNECTED;
}
ib_destroy_qp(isert_conn->qp);
isert_conn->qp = NULL;

View File

@@ -454,6 +454,7 @@ int isert_connection_closed(struct iscsi_conn *iscsi_conn)
wake_up(&dev->waitqueue);
isert_dev_release(dev);
isert_set_priv(iscsi_conn, NULL);
}
isert_free_connection(iscsi_conn);
@@ -528,13 +529,7 @@ static int isert_release(struct inode *inode, struct file *filp)
dev->sg_virt = NULL;
dev->is_discovery = 0;
if (!test_and_set_bit(ISERT_CONN_PASSED, &dev->flags)) {
BUG_ON(dev->conn == NULL);
isert_close_connection(dev->conn);
}
isert_del_timer(dev);
isert_delete_conn_dev(dev);
isert_dev_release(dev);
TRACE_EXIT_RES(res);