[PATCH 3.16 152/328] ISCSI: fix minor memory leak

From: Ben Hutchings
Date: Sun Dec 09 2018 - 17:14:39 EST


3.16.62-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Evgenii Lepikhin <johnlepikhin@xxxxxxxxx>

commit a928d28d4487402e6bd18bea1b8cc2b2ec6e6d8f upstream.

This patch adds a missing kfree for sess->sess_ops memory upon
transport_init_session() failure.

Signed-off-by: Evgenii Lepikhin <johnlepikhin@xxxxxxxxx>
Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
drivers/target/iscsi/iscsi_target_login.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -348,6 +348,7 @@ static int iscsi_login_zero_tsih_s1(
if (IS_ERR(sess->se_sess)) {
iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
ISCSI_LOGIN_STATUS_NO_RESOURCES);
+ kfree(sess->sess_ops);
kfree(sess);
return -ENOMEM;
}