enetc: tsn: release resource before exiting enetc_qci_sfi_counters_get() function
When testing FMI feature with below command tsntool qcisfiget --device eth0 --index 2 There is a memory leak occurring as below unreferenced object 0xffff000000402000 (size 128): comm "tsntool", pid 445, jiffies 4294959297 (age 25.588s) 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: [<000000007dda64ca>] kmem_cache_alloc_trace+0x3e8/0x680 [<00000000a11048d9>] enetc_qci_sfi_counters_get+0x6c/0x1c0 [<000000001154ca2b>] cmd_qci_sfi_get.isra.0+0xd4/0x3d0 [<0000000071bf773b>] tsn_qci_sfi_get+0x28/0x40 [<00000000cf9549d3>] genl_family_rcv_msg_doit+0xd0/0x15c [<000000004c0bcaf9>] genl_rcv_msg+0xec/0x1f0 [<00000000cb7761f5>] netlink_rcv_skb+0x64/0x130 [<000000005ac4890d>] genl_rcv+0x40/0x60 [<00000000ea5c8605>] netlink_unicast+0x230/0x310 [<000000005dc31afc>] netlink_sendmsg+0x1bc/0x400 [<00000000f8b85637>] __sys_sendto+0xd4/0x12c [<000000006b3b6e55>] __arm64_sys_sendto+0x30/0x40 [<00000000558195c4>] invoke_syscall+0x5c/0x130 [<000000009b6bc5a1>] el0_svc_common.constprop.0+0x4c/0x100 [<000000001d66b8d7>] do_el0_svc+0x4c/0xb4 [<000000001d739dd6>] el0_svc+0x28/0x80 Because the sfi_counter_data is not freed after it is used. In additional, refer to other functions, unmap DMA, too. 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