Skip to content

Commit c929ea0

Browse files
kinglongmeetrondmypd
authored andcommitted
SUNRPC: cleanup ida information when removing sunrpc module
After removing sunrpc module, I get many kmemleak information as, unreferenced object 0xffff88003316b1e0 (size 544): comm "gssproxy", pid 2148, jiffies 4294794465 (age 4200.081s) 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: [<ffffffffb0cfb58a>] kmemleak_alloc+0x4a/0xa0 [<ffffffffb03507fe>] kmem_cache_alloc+0x15e/0x1f0 [<ffffffffb0639baa>] ida_pre_get+0xaa/0x150 [<ffffffffb0639cfd>] ida_simple_get+0xad/0x180 [<ffffffffc06054fb>] nlmsvc_lookup_host+0x4ab/0x7f0 [lockd] [<ffffffffc0605e1d>] lockd+0x4d/0x270 [lockd] [<ffffffffc06061e5>] param_set_timeout+0x55/0x100 [lockd] [<ffffffffc06cba24>] svc_defer+0x114/0x3f0 [sunrpc] [<ffffffffc06cbbe7>] svc_defer+0x2d7/0x3f0 [sunrpc] [<ffffffffc06c71da>] rpc_show_info+0x8a/0x110 [sunrpc] [<ffffffffb044a33f>] proc_reg_write+0x7f/0xc0 [<ffffffffb038e41f>] __vfs_write+0xdf/0x3c0 [<ffffffffb0390f1f>] vfs_write+0xef/0x240 [<ffffffffb0392fbd>] SyS_write+0xad/0x130 [<ffffffffb0d06c37>] entry_SYSCALL_64_fastpath+0x1a/0xa9 [<ffffffffffffffff>] 0xffffffffffffffff I found, the ida information (dynamic memory) isn't cleanup. Signed-off-by: Kinglong Mee <[email protected]> Fixes: 2f048db ("SUNRPC: Add an identifier for struct rpc_clnt") Cc: [email protected] # v3.12+ Signed-off-by: Trond Myklebust <[email protected]>
1 parent a430607 commit c929ea0

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

include/linux/sunrpc/clnt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,6 @@ void rpc_clnt_xprt_switch_put(struct rpc_clnt *);
216216
void rpc_clnt_xprt_switch_add_xprt(struct rpc_clnt *, struct rpc_xprt *);
217217
bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt,
218218
const struct sockaddr *sap);
219+
void rpc_cleanup_clids(void);
219220
#endif /* __KERNEL__ */
220221
#endif /* _LINUX_SUNRPC_CLNT_H */

net/sunrpc/clnt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,11 @@ static int rpc_client_register(struct rpc_clnt *clnt,
336336

337337
static DEFINE_IDA(rpc_clids);
338338

339+
void rpc_cleanup_clids(void)
340+
{
341+
ida_destroy(&rpc_clids);
342+
}
343+
339344
static int rpc_alloc_clid(struct rpc_clnt *clnt)
340345
{
341346
int clid;

net/sunrpc/sunrpc_syms.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ init_sunrpc(void)
119119
static void __exit
120120
cleanup_sunrpc(void)
121121
{
122+
rpc_cleanup_clids();
122123
rpcauth_remove_module();
123124
cleanup_socket_xprt();
124125
svc_cleanup_xprt_sock();

0 commit comments

Comments
 (0)