enetc: tsn: release resource before exiting enetc_qci_fmi_get() function
When testing FMI feature with below command tsntool qcifmiget --device eth0 --index 2 There is a memory leak occurring as below unreferenced object 0xffff00000047e200 (size 128): comm "tsntool", pid 444, jiffies 4294931230 (age 17.688s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000a1f46be5>] kmem_cache_alloc_trace+0x3e8/0x680 [<0000000034f0835f>] enetc_qci_fmi_get+0x174/0x294 [<00000000c8de8870>] cmd_qci_fmi_get.isra.0+0xb8/0x390 [<00000000a5923a36>] tsn_qci_fmi_get+0x28/0x40 [<0000000016a765c0>] genl_family_rcv_msg_doit+0xd0/0x15c [<00000000468e65a1>] genl_rcv_msg+0xec/0x1f0 [<00000000a002deef>] netlink_rcv_skb+0x64/0x130 [<0000000063fa81de>] genl_rcv+0x40/0x60 [<0000000071bbebf2>] netlink_unicast+0x230/0x310 [<000000005fb3fad1>] netlink_sendmsg+0x1bc/0x400 [<000000008ac52897>] __sys_sendto+0xd4/0x12c [<00000000252525f3>] __arm64_sys_sendto+0x30/0x40 [<000000000d993fdc>] invoke_syscall+0x5c/0x130 [<0000000092b245b4>] el0_svc_common.constprop.0+0x4c/0x100 [<000000008829e8f3>] do_el0_svc+0x4c/0xb4 [<000000006bebec28>] el0_svc+0x28/0x80 Because the fmi_counter_data is not freed after it is used. In additional, refer to other functions, unmap DMA, and clear cbdr to 0 after it is used. Signed-off-by:Meng Li <Meng.Li@windriver.com> Signed-off-by:
Bruce Ashfield <bruce.ashfield@gmail.com>
Loading
Please register or sign in to comment