From cb7661cdec0787b44f930b4f39ffc9e731d66cbc Mon Sep 17 00:00:00 2001 From: Lance Hartmann Date: Wed, 14 Mar 2018 12:09:48 -0400 Subject: [PATCH] lib: Handle spdk_get_pdu() failure in spdk_iscsi_op_login() Prepares spdk_iscsi_op_login() to handle the case where spdk_get_pdu() will return NULL in a future patch instead of abort()'ing. Change-Id: I95da4ff967667f6439330d7959c6937c55522e9a Signed-off-by: Lance Hartmann Reviewed-on: https://review.gerrithub.io/403857 Reviewed-by: Shuhei Matsumoto Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 4c22c9b47..da574cb87 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -2216,6 +2216,9 @@ spdk_iscsi_op_login(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) rsp_pdu = spdk_get_pdu(); + if (rsp_pdu == NULL) { + return SPDK_ISCSI_CONNECTION_FATAL; + } rc = spdk_iscsi_op_login_rsp_init(conn, pdu, rsp_pdu, params_p, &alloc_len, &cid); if (rc == SPDK_ISCSI_LOGIN_ERROR_RESPONSE || rc == SPDK_ISCSI_LOGIN_ERROR_PARAMETER) {