isert: Fix crash in scenario when initiator opened connection but failed to send login request

Initialization of close_work was not done soon enough thus causing an error when timeout occured

Signed-off-by: Yan Burman <yanb@mellanox.com>

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5528 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Yan Burman
2014-05-19 07:15:55 +00:00
parent e577f7aff4
commit 117925943d

View File

@@ -116,6 +116,22 @@ static void isert_dev_release(struct isert_conn_dev *dev)
kref_put(&dev->kref, isert_kref_release_dev);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void isert_close_conn_fn(void *ctx)
#else
static void isert_close_conn_fn(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
struct iscsi_conn *conn = ctx;
#else
struct iscsi_conn *conn = container_of(work,
struct iscsi_conn, close_work);
#endif
isert_close_connection(conn);
}
static void isert_conn_timer_fn(unsigned long arg)
{
struct isert_conn_dev *conn_dev = (struct isert_conn_dev *)arg;
@@ -146,6 +162,12 @@ static int add_new_connection(struct isert_listener_dev *dev,
goto out;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&conn->close_work, isert_close_conn_fn, conn);
#else
INIT_WORK(&conn->close_work, isert_close_conn_fn);
#endif
init_timer(&conn_dev->tmo_timer);
conn_dev->tmo_timer.function = isert_conn_timer_fn;
conn_dev->tmo_timer.expires = jiffies + 120 * HZ;
@@ -170,22 +192,6 @@ static bool have_new_connection(struct isert_listener_dev *dev)
return ret;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
static void isert_close_conn_fn(void *ctx)
#else
static void isert_close_conn_fn(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
struct iscsi_conn *conn = ctx;
#else
struct iscsi_conn *conn = container_of(work,
struct iscsi_conn, close_work);
#endif
isert_close_connection(conn);
}
int isert_conn_alloc(struct iscsi_session *session,
struct iscsi_kern_conn_info *info,
struct iscsi_conn **new_conn,
@@ -231,12 +237,6 @@ int isert_conn_alloc(struct iscsi_session *session,
conn->transport = t;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
INIT_WORK(&conn->close_work, isert_close_conn_fn, conn);
#else
INIT_WORK(&conn->close_work, isert_close_conn_fn);
#endif
res = iscsi_init_conn(session, info, conn);
if (unlikely(res))
goto cleanup_conn;