From 7734777a25999dfc7731b07b2ce55ecaaf13ebba Mon Sep 17 00:00:00 2001 From: Lance Hartmann Date: Wed, 14 Mar 2018 12:47:56 -0400 Subject: [PATCH] iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_op_logout() Prepares spdk_iscsi_op_logout() to handle the case where spdk_get_pdu() will return NULL in a future patch instead of abort()'ing. Change-Id: I31f854741906023c734151e3b00b939cdafb2ec4 Signed-off-by: Lance Hartmann Reviewed-on: https://review.gerrithub.io/403864 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 185e165aa..28dacade3 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -2527,6 +2527,9 @@ spdk_iscsi_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) /* response PDU */ rsp_pdu = spdk_get_pdu(); + if (rsp_pdu == NULL) { + return SPDK_ISCSI_CONNECTION_FATAL; + } rsph = (struct iscsi_bhs_logout_resp *)&rsp_pdu->bhs; rsp_pdu->data = NULL; rsph->opcode = ISCSI_OP_LOGOUT_RSP;