linux-stable/include/linux/sunrpc
NeilBrown 47adb84916 SUNRPC: always free ctxt when freeing deferred request
[ Upstream commit 948f072ada ]

Since the ->xprt_ctxt pointer was added to svc_deferred_req, it has not
been sufficient to use kfree() to free a deferred request.  We may need
to free the ctxt as well.

As freeing the ctxt is all that ->xpo_release_rqst() does, we repurpose
it to explicit do that even when the ctxt is not stored in an rqst.
So we now have ->xpo_release_ctxt() which is given an xprt and a ctxt,
which may have been taken either from an rqst or from a dreq.  The
caller is now responsible for clearing that pointer after the call to
->xpo_release_ctxt.

We also clear dr->xprt_ctxt when the ctxt is moved into a new rqst when
revisiting a deferred request.  This ensures there is only one pointer
to the ctxt, so the risk of double freeing in future is reduced.  The
new code in svc_xprt_release which releases both the ctxt and any
rq_deferred depends on this.

Fixes: 773f91b2cf ("SUNRPC: Fix NFSD's request deferral on RDMA transports")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-24 17:32:45 +01:00
..
addr.h
auth.h
auth_gss.h
bc_xprt.h
cache.h
clnt.h SUNRPC: Add API to force the client to disconnect 2022-10-06 09:52:09 -04:00
debug.h
gss_api.h
gss_asn1.h
gss_err.h
gss_krb5.h
gss_krb5_enctypes.h
metrics.h
msg_prot.h
rpc_pipe_fs.h SUNRPC: ensure the matching upcall is in-flight upon downcall 2023-01-12 12:01:56 +01:00
rpc_rdma.h
rpc_rdma_cid.h
sched.h SUNRPC: remove the maximum number of retries in call_bind_status 2023-05-11 23:03:35 +09:00
stats.h
svc.h SUNRPC: Parametrize how much of argsize should be zeroed 2022-09-26 14:02:42 -04:00
svc_rdma.h SUNRPC: always free ctxt when freeing deferred request 2023-05-24 17:32:45 +01:00
svc_rdma_pcl.h
svc_xprt.h SUNRPC: always free ctxt when freeing deferred request 2023-05-24 17:32:45 +01:00
svcauth.h
svcauth_gss.h
svcsock.h
timer.h
types.h
xdr.h NFSD: Refactor common code out of dirlist helpers 2022-09-26 14:02:47 -04:00
xprt.h
xprtmultipath.h
xprtrdma.h
xprtsock.h