diff options
author | Maurizio Lombardi <mlombard@redhat.com> | 2014-06-27 08:55:20 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-25 17:17:01 -0400 |
commit | 6d67726bd898151e688d8729b3997ba8417c2c6b (patch) | |
tree | dde62d49198fb69e1ca2fb9eba7faf0e370ba999 | |
parent | 761f1193f299873236dbc21277864d70cb7ba8a3 (diff) |
be2iscsi: Fix memory leak in mgmt_set_ip()
The if_info pointer is not released by the mgmt_set_ip() function
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/be2iscsi/be_mgmt.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 07934b0b9ee1..a3e56487616c 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -1015,7 +1015,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1015 | if (if_info->dhcp_state) { | 1015 | if (if_info->dhcp_state) { |
1016 | beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, | 1016 | beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, |
1017 | "BG_%d : DHCP Already Enabled\n"); | 1017 | "BG_%d : DHCP Already Enabled\n"); |
1018 | return 0; | 1018 | goto exit; |
1019 | } | 1019 | } |
1020 | /* The ip_param->len is 1 in DHCP case. Setting | 1020 | /* The ip_param->len is 1 in DHCP case. Setting |
1021 | proper IP len as this it is used while | 1021 | proper IP len as this it is used while |
@@ -1033,7 +1033,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1033 | sizeof(*reldhcp)); | 1033 | sizeof(*reldhcp)); |
1034 | 1034 | ||
1035 | if (rc) | 1035 | if (rc) |
1036 | return rc; | 1036 | goto exit; |
1037 | 1037 | ||
1038 | reldhcp = nonemb_cmd.va; | 1038 | reldhcp = nonemb_cmd.va; |
1039 | reldhcp->interface_hndl = phba->interface_handle; | 1039 | reldhcp->interface_hndl = phba->interface_handle; |
@@ -1044,7 +1044,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1044 | beiscsi_log(phba, KERN_WARNING, | 1044 | beiscsi_log(phba, KERN_WARNING, |
1045 | BEISCSI_LOG_CONFIG, | 1045 | BEISCSI_LOG_CONFIG, |
1046 | "BG_%d : Failed to Delete existing dhcp\n"); | 1046 | "BG_%d : Failed to Delete existing dhcp\n"); |
1047 | return rc; | 1047 | goto exit; |
1048 | } | 1048 | } |
1049 | } | 1049 | } |
1050 | } | 1050 | } |
@@ -1054,7 +1054,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1054 | rc = mgmt_static_ip_modify(phba, if_info, ip_param, NULL, | 1054 | rc = mgmt_static_ip_modify(phba, if_info, ip_param, NULL, |
1055 | IP_ACTION_DEL); | 1055 | IP_ACTION_DEL); |
1056 | if (rc) | 1056 | if (rc) |
1057 | return rc; | 1057 | goto exit; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | /* Delete the Gateway settings if mode change is to DHCP */ | 1060 | /* Delete the Gateway settings if mode change is to DHCP */ |
@@ -1064,7 +1064,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1064 | if (rc) { | 1064 | if (rc) { |
1065 | beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, | 1065 | beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG, |
1066 | "BG_%d : Failed to Get Gateway Addr\n"); | 1066 | "BG_%d : Failed to Get Gateway Addr\n"); |
1067 | return rc; | 1067 | goto exit; |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | if (gtway_addr_set.ip_addr.addr[0]) { | 1070 | if (gtway_addr_set.ip_addr.addr[0]) { |
@@ -1076,7 +1076,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1076 | beiscsi_log(phba, KERN_WARNING, | 1076 | beiscsi_log(phba, KERN_WARNING, |
1077 | BEISCSI_LOG_CONFIG, | 1077 | BEISCSI_LOG_CONFIG, |
1078 | "BG_%d : Failed to clear Gateway Addr Set\n"); | 1078 | "BG_%d : Failed to clear Gateway Addr Set\n"); |
1079 | return rc; | 1079 | goto exit; |
1080 | } | 1080 | } |
1081 | } | 1081 | } |
1082 | } | 1082 | } |
@@ -1087,7 +1087,7 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1087 | OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR, | 1087 | OPCODE_COMMON_ISCSI_NTWK_CONFIG_STATELESS_IP_ADDR, |
1088 | sizeof(*dhcpreq)); | 1088 | sizeof(*dhcpreq)); |
1089 | if (rc) | 1089 | if (rc) |
1090 | return rc; | 1090 | goto exit; |
1091 | 1091 | ||
1092 | dhcpreq = nonemb_cmd.va; | 1092 | dhcpreq = nonemb_cmd.va; |
1093 | dhcpreq->flags = BLOCKING; | 1093 | dhcpreq->flags = BLOCKING; |
@@ -1095,12 +1095,14 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1095 | dhcpreq->interface_hndl = phba->interface_handle; | 1095 | dhcpreq->interface_hndl = phba->interface_handle; |
1096 | dhcpreq->ip_type = BE2_DHCP_V4; | 1096 | dhcpreq->ip_type = BE2_DHCP_V4; |
1097 | 1097 | ||
1098 | return mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); | 1098 | rc = mgmt_exec_nonemb_cmd(phba, &nonemb_cmd, NULL, 0); |
1099 | } else { | 1099 | } else { |
1100 | return mgmt_static_ip_modify(phba, if_info, ip_param, | 1100 | rc = mgmt_static_ip_modify(phba, if_info, ip_param, |
1101 | subnet_param, IP_ACTION_ADD); | 1101 | subnet_param, IP_ACTION_ADD); |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | exit: | ||
1105 | kfree(if_info); | ||
1104 | return rc; | 1106 | return rc; |
1105 | } | 1107 | } |
1106 | 1108 | ||