]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ethernet: marvell: octeontx2 Fix resource not freed after malloc
authorManank Patel <pmanank200502@gmail.com>
Tue, 18 Oct 2022 05:33:18 +0000 (11:03 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Oct 2022 12:43:41 +0000 (13:43 +0100)
fix rxsc and txsc not getting freed before going out of scope

Fixes: a500032f7534 ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading")
Signed-off-by: Manank Patel <pmanank200502@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c

index 9809f551fc2e3db0176f9115b78fc20be4539e9e..9ec5f38d38a8467850eb2ffe97e7cdc12027233a 100644 (file)
@@ -815,6 +815,7 @@ free_flowid:
        cn10k_mcs_free_rsrc(pfvf, MCS_TX, MCS_RSRC_TYPE_FLOWID,
                            txsc->hw_flow_id, false);
 fail:
+       kfree(txsc);
        return ERR_PTR(ret);
 }
 
@@ -870,6 +871,7 @@ free_flowid:
        cn10k_mcs_free_rsrc(pfvf, MCS_RX, MCS_RSRC_TYPE_FLOWID,
                            rxsc->hw_flow_id, false);
 fail:
+       kfree(rxsc);
        return ERR_PTR(ret);
 }