]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
NFS: Fix RCU dereference of cl_xprt in nfs_compare_super_address
authorSean Chang <seanwascoding@gmail.com>
Sun, 19 Apr 2026 16:31:38 +0000 (00:31 +0800)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 22 Apr 2026 12:53:23 +0000 (08:53 -0400)
commite6614b88d59d110ee1a80ed0826e34f24dd35c96
tree4cc0148ca7b6debbccf19272920170dc09258768
parente8a44ae87b553b0851a20bebf3d2634a45c5e316
NFS: Fix RCU dereference of cl_xprt in nfs_compare_super_address

The cl_xprt pointer in struct rpc_clnt is marked as __rcu. Accessing
it directly in nfs_compare_super_address() is unsafe and triggers
Sparse warnings.

Fix this by using rcu_dereference() within an RCU read-side critical
section to retrieve the transport pointer. This addresses the sparse
warning and ensures atomic access to the pointer, as the transport
can be updated via transport switching even while the superblock
remains active under sb_lock.

Fixes: 7e3fcf61abde ("nfs: don't share mounts between network namespaces")
Signed-off-by: Sean Chang <seanwascoding@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/super.c