linux-next/net/sunrpc/xprtrdma
Ye Bin ce89e742a4 svcrdma: fix miss destroy percpu_counter in svc_rdma_proc_init()
There's issue as follows:
RPC: Registered rdma transport module.
RPC: Registered rdma backchannel transport module.
RPC: Unregistered rdma transport module.
RPC: Unregistered rdma backchannel transport module.
BUG: unable to handle page fault for address: fffffbfff80c609a
PGD 123fee067 P4D 123fee067 PUD 123fea067 PMD 10c624067 PTE 0
Oops: Oops: 0000 [#1] PREEMPT SMP KASAN NOPTI
RIP: 0010:percpu_counter_destroy_many+0xf7/0x2a0
Call Trace:
 <TASK>
 __die+0x1f/0x70
 page_fault_oops+0x2cd/0x860
 spurious_kernel_fault+0x36/0x450
 do_kern_addr_fault+0xca/0x100
 exc_page_fault+0x128/0x150
 asm_exc_page_fault+0x26/0x30
 percpu_counter_destroy_many+0xf7/0x2a0
 mmdrop+0x209/0x350
 finish_task_switch.isra.0+0x481/0x840
 schedule_tail+0xe/0xd0
 ret_from_fork+0x23/0x80
 ret_from_fork_asm+0x1a/0x30
 </TASK>

If register_sysctl() return NULL, then svc_rdma_proc_cleanup() will not
destroy the percpu counters which init in svc_rdma_proc_init().
If CONFIG_HOTPLUG_CPU is enabled, residual nodes may be in the
'percpu_counters' list. The above issue may occur once the module is
removed. If the CONFIG_HOTPLUG_CPU configuration is not enabled, memory
leakage occurs.
To solve above issue just destroy all percpu counters when
register_sysctl() return NULL.

Fixes: 1e7e557316 ("svcrdma: Restore read and write stats")
Fixes: 22df5a2246 ("svcrdma: Convert rdma_stat_sq_starve to a per-CPU counter")
Fixes: df971cd853 ("svcrdma: Convert rdma_stat_recv to a per-CPU counter")
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-11-18 20:23:07 -05:00
..
backchannel.c SUNRPC: change the back-channel queue to lwq 2023-10-16 12:44:08 -04:00
frwr_ops.c xprtrdma: Clean up synopsis of frwr_mr_unmap() 2024-07-08 13:47:24 -04:00
ib_client.c rpcrdma: Always release the rpcrdma_device's xa_array 2024-10-30 16:14:00 -04:00
Makefile rpcrdma: Implement generic device removal 2024-07-08 13:47:24 -04:00
module.c rpcrdma: Implement generic device removal 2024-07-08 13:47:24 -04:00
rpc_rdma.c xprtrdma: Remove temp allocation of rpcrdma_rep objects 2024-07-08 13:47:24 -04:00
svc_rdma_backchannel.c svcrdma: Post Send WR chain 2024-03-01 09:12:28 -05:00
svc_rdma_pcl.c svcrdma: Add a "parsed chunk list" data structure 2020-11-30 13:00:22 -05:00
svc_rdma_recvfrom.c svcrdma: Address an integer overflow 2024-11-11 13:41:57 -05:00
svc_rdma_rw.c Revert "svcrdma: Add Write chunk WRs to the RPC's Send WR chain" 2024-04-20 11:20:41 -04:00
svc_rdma_sendto.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
svc_rdma_transport.c sunrpc: xprtrdma: Use ERR_CAST() to return 2024-09-20 19:31:03 -04:00
svc_rdma.c svcrdma: fix miss destroy percpu_counter in svc_rdma_proc_init() 2024-11-18 20:23:07 -05:00
transport.c net: sunrpc: Remove the now superfluous sentinel elements from ctl_table array 2024-05-03 13:29:42 +01:00
verbs.c xprtrdma: Remove temp allocation of rpcrdma_rep objects 2024-07-08 13:47:24 -04:00
xprt_rdma.h xprtrdma: Remove temp allocation of rpcrdma_rep objects 2024-07-08 13:47:24 -04:00