xprtrdma: Prevent leak of rpcrdma_rep objects
authorChuck Lever <chuck.lever@oracle.com>
Fri, 7 Dec 2018 16:11:44 +0000 (11:11 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:20:59 +0000 (09:20 +0100)
commitd95b814359f0b533570fe80f96603f70f09c9e17
tree752790f62bde0737e5153575c32781a45eea1d53
parentd398807976c904be4dfa2e7804d4ab43aa904774
xprtrdma: Prevent leak of rpcrdma_rep objects

[ Upstream commit 07e10308ee5da8e6132e0b737ece1c99dd651fb6 ]

If a reply has been processed but the RPC is later retransmitted
anyway, the req->rl_reply field still contains the only pointer to
the old rpcrdma rep. When the next reply comes in, the reply handler
will stomp on the rl_reply field, leaking the old rep.

A trace event is added to capture such leaks.

This problem seems to be worsened by the restructuring of the RPC
Call path in v4.20. Fully addressing this issue will require at
least a re-architecture of the disconnect logic, which is not
appropriate during -rc.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/trace/events/rpcrdma.h
net/sunrpc/xprtrdma/rpc_rdma.c