From: Olga Kornievskaia <okorniev@redhat.com>
To: trondmy@kernel.org, anna@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [RFC PATCH 0/3] protect access to bc_serv
Date: Mon, 27 Oct 2025 15:23:15 -0400 [thread overview]
Message-ID: <20251027192318.86366-1-okorniev@redhat.com> (raw)
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().
Olga Kornievskaia (3):
NFSv4.1: pass transport for callback shutdown
SUNRPC: protect access to rpc_xprt bc_serv
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 | 1 +
net/sunrpc/backchannel_rqst.c | 27 ++++++++++++++++++++++++---
net/sunrpc/xprtrdma/backchannel.c | 11 +++++++----
6 files changed, 46 insertions(+), 12 deletions(-)
--
2.47.1
next reply other threads:[~2025-10-27 19:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 19:23 Olga Kornievskaia [this message]
2025-10-27 19:23 ` [RFC PATCH 1/3] NFSv4.1: pass transport for callback shutdown Olga Kornievskaia
2025-10-27 19:23 ` [RFC PATCH 2/3] SUNRPC: protect access to rpc_xprt bc_serv Olga Kornievskaia
2025-10-27 19:23 ` [RFC PATCH 3/3] NFSv4.1: protect destroying and nullifying bc_serv structure Olga Kornievskaia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251027192318.86366-1-okorniev@redhat.com \
--to=okorniev@redhat.com \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).