diff --git a/iscsi-scst/kernel/isert-scst/iser.h b/iscsi-scst/kernel/isert-scst/iser.h index 8141ebcfd..8c1883c39 100644 --- a/iscsi-scst/kernel/isert-scst/iser.h +++ b/iscsi-scst/kernel/isert-scst/iser.h @@ -58,6 +58,7 @@ struct isert_wr { #define ISER_MAX_RDMAS 5 #define ISER_SQ_SIZE 128 +#define ISER_MAX_WCE 2048 struct isert_cmnd { struct iscsi_cmnd iscsi ____cacheline_aligned; diff --git a/iscsi-scst/kernel/isert-scst/iser_pdu.c b/iscsi-scst/kernel/isert-scst/iser_pdu.c index e07f53dc8..7d151db26 100644 --- a/iscsi-scst/kernel/isert-scst/iser_pdu.c +++ b/iscsi-scst/kernel/isert-scst/iser_pdu.c @@ -381,6 +381,13 @@ int isert_alloc_conn_resources(struct isert_connection *isert_conn) isert_conn->repost_threshold = 32; to_alloc = isert_conn->queue_depth * 2 + isert_conn->repost_threshold; + if (unlikely(to_alloc > ISER_MAX_WCE)) { + pr_err("QueuedCommands larger than %d not supported\n", + (ISER_MAX_WCE - isert_conn->repost_threshold) / 2); + err = -EINVAL; + goto out; + } + for (i = 0; i < to_alloc; i++) { pdu = isert_rx_pdu_alloc(isert_conn, t_datasz); if (unlikely(!pdu)) { diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index f5cfeb19b..8185847d6 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -41,7 +41,6 @@ #include "iser_datamover.h" #define ISER_CQ_ENTRIES (128 * 1024) -#define ISER_MAX_WCE 2048 #define ISER_LISTEN_BACKLOG 8 static DEFINE_MUTEX(dev_list_mutex);