xprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed
authorChuck Lever <chuck.lever@oracle.com>
Mon, 15 Jun 2020 13:20:52 +0000 (09:20 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 22 Jun 2020 13:34:35 +0000 (09:34 -0400)
commit2acc5cae292355f5f18ad377a2a966e7f03c8fec
tree695d23aa62617542560bed45e78e7a8ec41a9014
parent48778464bb7d346b47157d21ffde2af6b2d39110
xprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed

r_xprt->rx_ep is known to be good while the transport's send lock is
held.  Otherwise additional references on rx_ep must be held when it
is used outside of that lock's critical sections.

For now, bump the rx_ep reference count once whenever there is at
least one outstanding Receive WR. This avoids the memory bandwidth
overhead of taking and releasing the reference count for every
ib_post_recv() and Receive completion.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/verbs.c