linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] protect access to bc_serv
@ 2025-11-03 22:13 Olga Kornievskaia
  2025-11-03 22:13 ` [PATCH v3 1/4] NFSv4.1: pass transport for callback shutdown Olga Kornievskaia
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Olga Kornievskaia @ 2025-11-03 22:13 UTC (permalink / raw)
  To: trondmy, anna; +Cc: linux-nfs

This patch series tries to address the problem that can arise when
the client is shutting down but gets a backchannel request. As it
stands now, In nfs4_shutdown_client() we call nfs4_destroy_callback()
which would destroy/free the bc_serv structure stored in an xprt
structure. But the xprt structure is still around for a bit until
it's destroyed. If we get backchannel request after svc_destroy()
is called, then in xprt_complete_bc_request() we are accessing freed
memory.

I propose to use bc_pa_lock lock to protect access to the bc_serv
structure and make sure we free/nullify bc_serv under the lock
and then access it under a lock in  xs_complete_bs_request() and
rpcrdma_bc_receive_call().

-- v3 Addressing Anna'a comments. (1) created function for shared
code between tcp/rdma backchannel and (2) created
xprt_svc_destroy_nullify_bc() for both on/off CONFIG_SUNRPC_BACKCHANNEL
values.

-- v2 fixing kernel test bot reported compile error in usage of
xprt_svc_destroy_nullify_bc (CONFIG_SUNRPC_BACKCHANNEL toggle related)

Olga Kornievskaia (4):
  NFSv4.1: pass transport for callback shutdown
  SUNRPC: cleanup common code in backchannel request
  SUNRPC: new helper function for stopping backchannel server
  NFSv4.1: protect destroying and nullifying bc_serv structure

 fs/nfs/callback.c                 |  7 +++++--
 fs/nfs/callback.h                 |  3 ++-
 fs/nfs/nfs4client.c               |  9 ++++++--
 include/linux/sunrpc/bc_xprt.h    |  6 ++++++
 net/sunrpc/backchannel_rqst.c     | 35 ++++++++++++++++++++++++++++---
 net/sunrpc/xprtrdma/backchannel.c |  8 ++-----
 6 files changed, 54 insertions(+), 14 deletions(-)

-- 
2.47.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-11-04 20:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 22:13 [PATCH v3 0/4] protect access to bc_serv Olga Kornievskaia
2025-11-03 22:13 ` [PATCH v3 1/4] NFSv4.1: pass transport for callback shutdown Olga Kornievskaia
2025-11-03 22:13 ` [PATCH v3 2/4] SUNRPC: cleanup common code in backchannel request Olga Kornievskaia
2025-11-03 22:13 ` [PATCH v3 3/4] SUNRPC: new helper function for stopping backchannel server Olga Kornievskaia
2025-11-04 16:52   ` kernel test robot
2025-11-04 20:17   ` Anna Schumaker
2025-11-03 22:13 ` [PATCH v3 4/4] NFSv4.1: protect destroying and nullifying bc_serv structure Olga Kornievskaia
2025-11-04 20:45   ` Anna Schumaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).