liquidio: add cleanup in octeon_setup_iq() [Linux 4.19.72]

This Linux kernel change "liquidio: add cleanup in octeon_setup_iq()" is included in the Linux 4.19.72 release. This change is authored by Wenwen Wang <wenwen [at] cs.uga.edu> on Wed Aug 14 00:14:49 2019 -0500. The commit for this change in Linux stable tree is f13b7ec (patch) which is from upstream commit 6f967f8. 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 6f967f8.

liquidio: add cleanup in octeon_setup_iq()

[ Upstream commit 6f967f8b1be7001b31c46429f2ee7d275af2190f ]

If oct->fn_list.enable_io_queues() fails, no cleanup is executed, leading
to memory/resource leaks. To fix this issue, invoke
octeon_delete_instr_queue() before returning from the function.

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 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/cavium/liquidio/request_manager.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/request_manager.c b/drivers/net/ethernet/cavium/liquidio/request_manager.c
index 8f746e1..3deb3c0 100644
--- a/drivers/net/ethernet/cavium/liquidio/request_manager.c
+++ b/drivers/net/ethernet/cavium/liquidio/request_manager.c
@@ -238,8 +238,10 @@ int octeon_setup_iq(struct octeon_device *oct,
    }

    oct->num_iqs++;
-   if (oct->fn_list.enable_io_queues(oct))
+   if (oct->fn_list.enable_io_queues(oct)) {
+       octeon_delete_instr_queue(oct, iq_no);
        return 1;
+   }

    return 0;
 }

Leave a Reply

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