[PATCH 4.18 001/235] be2net: Fix memory leak in be_cmd_get_profile_config()

From: Greg Kroah-Hartman
Date: Mon Sep 24 2018 - 08:26:57 EST


4.18-stable review patch. If anyone has any objections, please let me know.

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

From: Petr Oros <poros@xxxxxxxxxx>

[ Upstream commit 9d7f19dc4673fbafebfcbf30eb90e09fa7d1c037 ]

DMA allocated memory is lost in be_cmd_get_profile_config() when we
call it with non-NULL port_res parameter.

Signed-off-by: Petr Oros <poros@xxxxxxxxxx>
Reviewed-by: Ivan Vecera <ivecera@xxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -4500,7 +4500,7 @@ int be_cmd_get_profile_config(struct be_
port_res->max_vfs += le16_to_cpu(pcie->num_vfs);
}
}
- return status;
+ goto err;
}

pcie = be_get_pcie_desc(resp->func_param, desc_count,