From f297ef6f3818ebbea0e857c109e21b6c62a87d8f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 26 Apr 2016 14:12:17 +0000 Subject: [PATCH] isert: fix double free of a fake request A nop that is sent from the scst is treated as a fake request. When a fake request is allocated we release it immediately, so it's wrong to release it also on a completion error (isert_pdu_err). This commit fix a NULL dereference bug when receiving completion with error on this nop. Signed-off-by: Israel Rukshin Signed-off-by: Ariel Nahum git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6876 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser_rdma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 59e44dbb3..fc038695d 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -637,7 +637,7 @@ static void isert_handle_wc_error(struct ib_wc *wc) #endif if (unlikely(num_sge == 0)) /* Drain WR */ isert_sched_conn_drained(isert_conn); - else + else if (!isert_pdu->is_fake_rx) isert_pdu_err(&isert_pdu->iscsi); break; case ISER_WR_RDMA_READ: @@ -646,7 +646,8 @@ static void isert_handle_wc_error(struct ib_wc *wc) isert_buf->dma_dir); isert_buf->sg_cnt = 0; } - isert_pdu_err(&isert_pdu->iscsi); + if (!isert_pdu->is_fake_rx) + isert_pdu_err(&isert_pdu->iscsi); break; case ISER_WR_RECV: /* this should be the Flush, no task has been created yet */