linux/net/sunrpc
Xin Xiong bfc48f1b05 net/sunrpc: fix potential memory leaks in rpc_sysfs_xprt_state_change()
The issue happens on some error handling paths. When the function
fails to grab the object `xprt`, it simply returns 0, forgetting to
decrease the reference count of another object `xps`, which is
increased by rpc_sysfs_xprt_kobj_get_xprt_switch(), causing refcount
leaks. Also, the function forgets to check whether `xps` is valid
before using it, which may result in NULL-dereferencing issues.

Fix it by adding proper error handling code when either `xprt` or
`xps` is NULL.

Fixes: 5b7eb78486 ("SUNRPC: take a xprt offline using sysfs")
Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-12 11:21:28 +01:00
..
auth_gss
xprtrdma
Kconfig
Makefile
addr.c
auth.c NFS client updates for Linux 5.20 2022-08-10 14:04:32 -07:00
auth_null.c
auth_unix.c
backchannel_rqst.c NFS client updates for Linux 5.20 2022-08-10 14:04:32 -07:00
cache.c
clnt.c
debugfs.c
fail.h
netns.h
rpc_pipe.c
rpcb_clnt.c
sched.c
socklib.c
socklib.h
stats.c
sunrpc.h
sunrpc_syms.c
svc.c
svc_xprt.c SUNRPC: Expand the svc_alloc_arg_err tracepoint 2022-07-29 20:08:56 -04:00
svcauth.c
svcauth_unix.c
svcsock.c
sysctl.c
sysfs.c net/sunrpc: fix potential memory leaks in rpc_sysfs_xprt_state_change() 2022-08-12 11:21:28 +01:00
sysfs.h
timer.c
xdr.c
xprt.c
xprtmultipath.c
xprtsock.c