net: myri10ge: fix memory leaks [Linux 4.4.192]

This Linux kernel change "net: myri10ge: fix memory leaks" is included in the Linux 4.4.192 release. This change is authored by Wenwen Wang <wenwen [at] cs.uga.edu> on Wed Aug 14 01:38:39 2019 -0500. The commit for this change in Linux stable tree is f6f3170 (patch) which is from upstream commit 20fb7c7. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 20fb7c7.

net: myri10ge: fix memory leaks

[ Upstream commit 20fb7c7a39b5c719e2e619673b5f5729ee7d2306 ]

In myri10ge_probe(), myri10ge_alloc_slices() is invoked to allocate slices
related structures. Later on, myri10ge_request_irq() is used to get an irq.
However, if this process fails, the allocated slices related structures are
not deallocated, leading to memory leaks. To fix this issue, revise the
target label of the goto statement to 'abort_with_slices'.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 83651ac..8ebf361 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -4114,7 +4114,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
     * setup (if available). */
    status = myri10ge_request_irq(mgp);
    if (status != 0)
-       goto abort_with_firmware;
+       goto abort_with_slices;
    myri10ge_free_irq(mgp);

    /* Save configuration space to be restored if the

Leave a Reply

Your email address will not be published. Required fields are marked *