Commit 6d67726b authored by Maurizio Lombardi's avatar Maurizio Lombardi Committed by Christoph Hellwig

be2iscsi: Fix memory leak in mgmt_set_ip()

The if_info pointer is not released by the mgmt_set_ip() function
Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 761f1193
...@@ -1015,7 +1015,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1015,7 +1015,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
if (if_info->dhcp_state) { if (if_info->dhcp_state) {
beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
"BG_%d : DHCP Already Enabled\n"); "BG_%d : DHCP Already Enabled\n");
return 0; goto exit;
} }
/* The ip_param->len is 1 in DHCP case. Setting /* The ip_param->len is 1 in DHCP case. Setting
proper IP len as this it is used while proper IP len as this it is used while
...@@ -1033,7 +1033,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1033,7 +1033,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
sizeof(*reldhcp)); sizeof(*reldhcp));
if (rc) if (rc)
return rc; goto exit;
reldhcp = nonemb_cmd.va; reldhcp = nonemb_cmd.va;
reldhcp->interface_hndl = phba->interface_handle; reldhcp->interface_hndl = phba->interface_handle;
...@@ -1044,7 +1044,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1044,7 +1044,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
beiscsi_log(phba, KERN_WARNING, beiscsi_log(phba, KERN_WARNING,
BEISCSI_LOG_CONFIG, BEISCSI_LOG_CONFIG,
"BG_%d : Failed to Delete existing dhcp\n"); "BG_%d : Failed to Delete existing dhcp\n");
return rc; goto exit;
} }
} }
} }
...@@ -1054,7 +1054,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1054,7 +1054,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
rc = mgmt_static_ip_modify(phba, if_info, ip_param, NULL, rc = mgmt_static_ip_modify(phba, if_info, ip_param, NULL,
IP_ACTION_DEL); IP_ACTION_DEL);
if (rc) if (rc)
return rc; goto exit;
} }
/* Delete the Gateway settings if mode change is to DHCP */ /* Delete the Gateway settings if mode change is to DHCP */
...@@ -1064,7 +1064,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1064,7 +1064,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
if (rc) { if (rc) {
beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
"BG_%d : Failed to Get Gateway Addr\n"); "BG_%d : Failed to Get Gateway Addr\n");
return rc; goto exit;
} }
if (gtway_addr_set.ip_addr.addr[0]) { if (gtway_addr_set.ip_addr.addr[0]) {
...@@ -1076,7 +1076,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1076,7 +1076,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
beiscsi_log(phba, KERN_WARNING, beiscsi_log(phba, KERN_WARNING,
BEISCSI_LOG_CONFIG, BEISCSI_LOG_CONFIG,
"BG_%d : Failed to clear Gateway Addr Set\n"); "BG_%d : Failed to clear Gateway Addr Set\n");
return rc; goto exit;
} }
} }
} }
...@@ -1087,7 +1087,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1087,7 +1087,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR, OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR,
sizeof(*dhcpreq)); sizeof(*dhcpreq));
if (rc) if (rc)
return rc; goto exit;
dhcpreq = nonemb_cmd.va; dhcpreq = nonemb_cmd.va;
dhcpreq->flags = BLOCKING; dhcpreq->flags = BLOCKING;
...@@ -1095,12 +1095,14 @@ int mgmt_set_ip(struct beiscsi_hba *phba, ...@@ -1095,12 +1095,14 @@ int mgmt_set_ip(struct beiscsi_hba *phba,
dhcpreq->interface_hndl = phba->interface_handle; dhcpreq->interface_hndl = phba->interface_handle;
dhcpreq->ip_type = BE2_DHCP_V4; dhcpreq->ip_type = BE2_DHCP_V4;
return mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0);
} else { } else {
return mgmt_static_ip_modify(phba, if_info, ip_param, rc = mgmt_static_ip_modify(phba, if_info, ip_param,
subnet_param, IP_ACTION_ADD); subnet_param, IP_ACTION_ADD);
} }
exit:
kfree(if_info);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment