0022-init-fix-memory-leak-in-iscsi_create_context.patch 0023-iscsi-command-Fix-leak-in-iscsi_send_data_out.patcha391176a6d2674070fb8Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
35 lines
1.2 KiB
Diff
35 lines
1.2 KiB
Diff
From 2674070fb80ad7527589a1fbd576ee074d26ed72 Mon Sep 17 00:00:00 2001
|
|
From: Raphael Norwitz <raphael.norwitz@nutanix.com>
|
|
Date: Tue, 1 Mar 2022 18:03:48 -0500
|
|
Subject: [PATCH] iscsi-command: Fix leak in iscsi_send_data_out
|
|
|
|
In iscsi_send_data_out() a PDU is allocated, but there is no error
|
|
handling logic to free it if the PDU cannot be queued.
|
|
iscsi_allocate_pdu() may allocate memory for the PDU. This memory may be
|
|
leaked if iscsi_queue_pdu() fails since there is no call to free it.
|
|
|
|
Orignally there was a free() call but it was removed as a part of a
|
|
cleanup adding checks for NULL pdu callbacks.
|
|
|
|
Fixes: 423b82efa4bd ("pdu: check callback for NULL everywhere")
|
|
Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
|
|
---
|
|
lib/iscsi-command.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c
|
|
index a4df637..9a240ab 100644
|
|
--- a/lib/iscsi-command.c
|
|
+++ b/lib/iscsi-command.c
|
|
@@ -131,6 +131,7 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu,
|
|
if (iscsi_queue_pdu(iscsi, pdu) != 0) {
|
|
iscsi_set_error(iscsi, "Out-of-memory: failed to queue iscsi "
|
|
"scsi pdu.");
|
|
+ iscsi->drv->free_pdu(iscsi, pdu);
|
|
goto error;
|
|
}
|
|
|
|
--
|
|
2.35.3
|
|
|