<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs/lockd, branch master</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>Merge tag 'nfs-for-7.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs</title>
<updated>2026-08-26T22:09:21+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-08-26T22:09:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=73e3f0710014fe6d4ed98cfc02292f6121db7558'/>
<id>73e3f0710014fe6d4ed98cfc02292f6121db7558</id>
<content type='text'>
Pull NFS client updates from Trond Myklebust:
 "Highlights include:

  Stable fixes:
   - Use-after-free fixes for the sunrpc client code
   - Delegation hash table leak
   - NULL dereference on lockowner allocation failure
   - Fix a handshake completion race in the TLS code
   - Fix an error sign checking issue when deciding whether the pNFS
     layout is still in use, or can be returned
   - Fix a layout segment leak in pnfs_layout_process()

  Other bugfixes:
   - Fix a missing NULL check in the rpcbind client
   - annotate shared socket callbacks with READ_ONCE/WRITE_ONCE
   - nfs_inode_set_delegation() error paths should return the delegation
   - Use clear_and_wake_up_bit() in nfs_clear_invalid_mapping() and the
     pNFS code.
   - Fix the nfs4_alloc_client() error paths to free the IDR allocation
   - fix folio dereference before NULL check in
     nfs_inode_remove_request()
   - Fix delayed delegation return
   - Fix another state manager race with umount
   - Fix device leaks on parse failure
   - Avoid cancelling in-flight I/O during a layout recall if the server
     doesn't require it
   - flexfiles: report cancelled I/O as a layout error
   - flexfiles: fix NULL dereference for NFSv4.0 data servers
   - Fix incorrect argument passed to nfs4_delete_lease()
   - Fix several symlink issues resulting from nfs_atomic_open_v23()
   - Fix an uninitialised variable issue in the NFSv4.1 callback code
   - fix LAYOUTSTATS send buffer exhaustion

  Features and cleanups:
   - NFSv4.2: Allow the server to specify that file data may not be cached
   - localio: optimise I/O submission when when not doing memory reclaim
   - localio: Remove duplicate wait code in nfs_local_commit
   - flexfiles: support loosely coupled NFSv4.x data servers
   - pNFS: key the data server cache on the NFS version"

* tag 'nfs-for-7.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (33 commits)
  NFSv4.1: fix layout segment leak on the pnfs_layout_process() forget path
  NFSv4/pnfs: key the data server cache on the NFS version
  NFSv4.2: fix LAYOUTSTATS send buffer exhaustion
  pNFS: Fix EBUSY check in pnfs_layout_need_return
  NFSv4.1: zero referring call lists before decoding
  nfs: fix ENXIO on O_CREAT open of existing symlink over NFSv3
  SUNRPC: wait for in-flight client TLS handshake callback
  NFSv4: Fix incorrect argument passed to nfs4_delete_lease() in nfs4_add_lease()
  lockd: fix NULL dereference on lockowner allocation failure
  NFS: fix delegation_hash_table leak when nfs4_server_common_setup() fails
  NFSv4/flexfiles: support loosely coupled data servers
  NFSv4/flexfiles: fix NULL dereference for NFSv4.0 data servers
  NFSv4: pin the superblock for active state owners
  sunrpc: fix use-after-free in __rpc_clnt_handle_event and __rpc_clnt_remove_pipedir
  NFS/localio: issue commit inline when not in a memory-reclaim context
  NFS/localio: remove dead FLUSH_SYNC handling from nfs_local_commit
  NFS/localio: issue IO inline when not in a memory-reclaim context
  NFS: Fix delayed delegation return list handling
  NFS: Verify symlink inode before caching target
  NFS: fix folio dereference before NULL check in nfs_inode_remove_request()
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull NFS client updates from Trond Myklebust:
 "Highlights include:

  Stable fixes:
   - Use-after-free fixes for the sunrpc client code
   - Delegation hash table leak
   - NULL dereference on lockowner allocation failure
   - Fix a handshake completion race in the TLS code
   - Fix an error sign checking issue when deciding whether the pNFS
     layout is still in use, or can be returned
   - Fix a layout segment leak in pnfs_layout_process()

  Other bugfixes:
   - Fix a missing NULL check in the rpcbind client
   - annotate shared socket callbacks with READ_ONCE/WRITE_ONCE
   - nfs_inode_set_delegation() error paths should return the delegation
   - Use clear_and_wake_up_bit() in nfs_clear_invalid_mapping() and the
     pNFS code.
   - Fix the nfs4_alloc_client() error paths to free the IDR allocation
   - fix folio dereference before NULL check in
     nfs_inode_remove_request()
   - Fix delayed delegation return
   - Fix another state manager race with umount
   - Fix device leaks on parse failure
   - Avoid cancelling in-flight I/O during a layout recall if the server
     doesn't require it
   - flexfiles: report cancelled I/O as a layout error
   - flexfiles: fix NULL dereference for NFSv4.0 data servers
   - Fix incorrect argument passed to nfs4_delete_lease()
   - Fix several symlink issues resulting from nfs_atomic_open_v23()
   - Fix an uninitialised variable issue in the NFSv4.1 callback code
   - fix LAYOUTSTATS send buffer exhaustion

  Features and cleanups:
   - NFSv4.2: Allow the server to specify that file data may not be cached
   - localio: optimise I/O submission when when not doing memory reclaim
   - localio: Remove duplicate wait code in nfs_local_commit
   - flexfiles: support loosely coupled NFSv4.x data servers
   - pNFS: key the data server cache on the NFS version"

* tag 'nfs-for-7.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (33 commits)
  NFSv4.1: fix layout segment leak on the pnfs_layout_process() forget path
  NFSv4/pnfs: key the data server cache on the NFS version
  NFSv4.2: fix LAYOUTSTATS send buffer exhaustion
  pNFS: Fix EBUSY check in pnfs_layout_need_return
  NFSv4.1: zero referring call lists before decoding
  nfs: fix ENXIO on O_CREAT open of existing symlink over NFSv3
  SUNRPC: wait for in-flight client TLS handshake callback
  NFSv4: Fix incorrect argument passed to nfs4_delete_lease() in nfs4_add_lease()
  lockd: fix NULL dereference on lockowner allocation failure
  NFS: fix delegation_hash_table leak when nfs4_server_common_setup() fails
  NFSv4/flexfiles: support loosely coupled data servers
  NFSv4/flexfiles: fix NULL dereference for NFSv4.0 data servers
  NFSv4: pin the superblock for active state owners
  sunrpc: fix use-after-free in __rpc_clnt_handle_event and __rpc_clnt_remove_pipedir
  NFS/localio: issue commit inline when not in a memory-reclaim context
  NFS/localio: remove dead FLUSH_SYNC handling from nfs_local_commit
  NFS/localio: issue IO inline when not in a memory-reclaim context
  NFS: Fix delayed delegation return list handling
  NFS: Verify symlink inode before caching target
  NFS: fix folio dereference before NULL check in nfs_inode_remove_request()
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>lockd: fix NULL dereference on lockowner allocation failure</title>
<updated>2026-08-17T16:02:08+00:00</updated>
<author>
<name>Shuangpeng Bai</name>
<email>shuangpeng.kernel@gmail.com</email>
</author>
<published>2026-07-17T17:28:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4c7fc129db061c7daab841c4f3c342d894832362'/>
<id>4c7fc129db061c7daab841c4f3c342d894832362</id>
<content type='text'>
nlmclnt_locks_init_private() installs NLM file lock operations even when
nlmclnt_find_lockowner() fails to allocate a lockowner. nlmclnt_proc()
then returns -ENOMEM, but the VFS still tears down the partially
initialized file_lock and calls locks_release_private().

That invokes nlmclnt_locks_release_private(), which dereferences
fl-&gt;fl_u.nfs_fl.owner and crashes because the owner was never installed.

Clear fl_ops before attempting to initialize the NLM private state, and
install the NLM lock operations only after a lockowner has been allocated
successfully.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Shuangpeng Bai &lt;shuangpeng.kernel@gmail.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
nlmclnt_locks_init_private() installs NLM file lock operations even when
nlmclnt_find_lockowner() fails to allocate a lockowner. nlmclnt_proc()
then returns -ENOMEM, but the VFS still tears down the partially
initialized file_lock and calls locks_release_private().

That invokes nlmclnt_locks_release_private(), which dereferences
fl-&gt;fl_u.nfs_fl.owner and crashes because the owner was never installed.

Clear fl_ops before attempting to initialize the NLM private state, and
install the NLM lock operations only after a lockowner has been allocated
successfully.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Shuangpeng Bai &lt;shuangpeng.kernel@gmail.com&gt;
Signed-off-by: Trond Myklebust &lt;trond.myklebust@hammerspace.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sunrpc: remove unused svc_version vs_count field</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@kernel.org</email>
</author>
<published>2026-07-17T11:08:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5e4c283cb32f5d66618ffa9b5403ea09a60f2b61'/>
<id>5e4c283cb32f5d66618ffa9b5403ea09a60f2b61</id>
<content type='text'>
Now that svc_seq_show() and the nfsd netlink stats handler both use
the per-netns svc_stat vs_count arrays, the global per-version
vs_count percpu counters are no longer read by anything. Remove the
vs_count field from struct svc_version and all the associated
DEFINE_PER_CPU_ALIGNED arrays and initializers across nfsd, lockd,
and the NFS client callback service.

Assisted-by: LLM
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://patch.msgid.link/20260717-exportd-netlink-v7-4-b7ce17b83b60@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that svc_seq_show() and the nfsd netlink stats handler both use
the per-netns svc_stat vs_count arrays, the global per-version
vs_count percpu counters are no longer read by anything. Remove the
vs_count field from struct svc_version and all the associated
DEFINE_PER_CPU_ALIGNED arrays and initializers across nfsd, lockd,
and the NFS client callback service.

Assisted-by: LLM
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://patch.msgid.link/20260717-exportd-netlink-v7-4-b7ce17b83b60@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>xdrgen: Share void RPC procedure handlers across programs</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>cel@kernel.org</email>
</author>
<published>2026-07-12T19:31:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0cfead4c11bd7557b7e10f62e78342fe62b97c52'/>
<id>0cfead4c11bd7557b7e10f62e78342fe62b97c52</id>
<content type='text'>
The generated server-side decoder and encoder for a void procedure
argument or result are named after the RPC program (for example,
nfs_svc_decode_void). xdrgen derives that prefix from the program
name alone, not the version, so two versions of one program built
into the same module emit the identical symbol. NFSv2 and NFSv3
both declare program NFS_PROGRAM; once both are converted, fs/nfsd
fails to link with multiple definitions of nfs_svc_decode_void and
nfs_svc_encode_void.

A void handler carries no program- or version-specific behavior:
each merely forwards to xdrgen_decode_void() or xdrgen_encode_void().
Define one shared pair, xdrgen_svc_decode_void() and
xdrgen_svc_encode_void(), in the xdrgen builtins, and stop the
program generator from emitting a per-program void handler.

lockd is the one in-tree consumer that already emits per-program
void handlers, so regenerate the NLMv3 and NLMv4 XDR code to drop
nlm_svc_{decode,encode}_void() and nlm4_svc_{decode,encode}_void()
and point both procedure tables at the shared handlers. The shared
handlers are identical to the generated ones they replace, so no
wire behavior changes.

Only the server (svc) handlers are affected. The client-side void
stubs remain static and per-program, so they do not collide.

Link: https://patch.msgid.link/20260712193122.116845-3-cel@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The generated server-side decoder and encoder for a void procedure
argument or result are named after the RPC program (for example,
nfs_svc_decode_void). xdrgen derives that prefix from the program
name alone, not the version, so two versions of one program built
into the same module emit the identical symbol. NFSv2 and NFSv3
both declare program NFS_PROGRAM; once both are converted, fs/nfsd
fails to link with multiple definitions of nfs_svc_decode_void and
nfs_svc_encode_void.

A void handler carries no program- or version-specific behavior:
each merely forwards to xdrgen_decode_void() or xdrgen_encode_void().
Define one shared pair, xdrgen_svc_decode_void() and
xdrgen_svc_encode_void(), in the xdrgen builtins, and stop the
program generator from emitting a per-program void handler.

lockd is the one in-tree consumer that already emits per-program
void handlers, so regenerate the NLMv3 and NLMv4 XDR code to drop
nlm_svc_{decode,encode}_void() and nlm4_svc_{decode,encode}_void()
and point both procedure tables at the shared handlers. The shared
handlers are identical to the generated ones they replace, so no
wire behavior changes.

Only the server (svc) handlers are affected. The client-side void
stubs remain static and per-program, so they do not collide.

Link: https://patch.msgid.link/20260712193122.116845-3-cel@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>xdrgen: Emit a blank line ahead of enum declarations</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>cel@kernel.org</email>
</author>
<published>2026-07-12T19:31:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ec5a7c2dceb09caf36262ecbd633eb7d4f9e4d3d'/>
<id>ec5a7c2dceb09caf36262ecbd633eb7d4f9e4d3d</id>
<content type='text'>
Clean up.

The declaration templates for structs, pointers, and typedefs each
begin with a blank line, which keeps successive declarations and the
include block above them visually separated. The enum declaration
template omits that blank line. trim_blocks collapses the template's
lone comment line to nothing, so the omission stayed invisible as
long as every generated header happened to lead with a non-enum
declaration.

Fixes: 4329010ad9c3 ("xdrgen: Address some checkpatch whitespace complaints")
Link: https://patch.msgid.link/20260712193122.116845-2-cel@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clean up.

The declaration templates for structs, pointers, and typedefs each
begin with a blank line, which keeps successive declarations and the
include block above them visually separated. The enum declaration
template omits that blank line. trim_blocks collapses the template's
lone comment line to nothing, so the omission stayed invisible as
long as every generated header happened to lead with a non-enum
declaration.

Fixes: 4329010ad9c3 ("xdrgen: Address some checkpatch whitespace complaints")
Link: https://patch.msgid.link/20260712193122.116845-2-cel@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lockd: preserve multiple NLM_SHARE grants from the same owner</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Oscar Ou</name>
<email>oscarou@synology.com</email>
</author>
<published>2026-07-03T06:38:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=737e9ac7faa46ba4cc1ccd294780d84b03beff95'/>
<id>737e9ac7faa46ba4cc1ccd294780d84b03beff95</id>
<content type='text'>
When an NFSv3/NLM client issues multiple NLM_SHARE calls from a single
host for the same (file, owner) tuple, the current implementation
overwrites the recorded access and deny modes with the latest pair.
A subsequent NLM_UNSHARE then drops the entire entry, even if other
grants were implicitly subsumed by the most recent SHARE.  This is
particularly visible to Windows-style clients that map each open of
a file to a distinct NLM_SHARE, all carrying the same NLM owner
handle.  For example:

    1. SHARE(access=RW, deny=W)   -&gt; entry [RW, deny W]
    2. SHARE(access=R,  deny=N)   -&gt; entry [R, deny N]   (RW/W overwritten)
    3. UNSHARE(access=R, deny=N)  -&gt; entry freed
    4. UNSHARE(access=RW, deny=W) -&gt; nothing to release

NLM has no duplicate reply cache, so both SHARE and UNSHARE handlers
must be idempotent under UDP retransmit.

Track each (access, deny) pair with a single bit in a u16 bitmap.
fsh_access and fsh_mode are each in {0..3}, so there are 16 possible
pairs; index = (access &lt;&lt; 2) | deny.  SHARE sets the bit, UNSHARE
clears it, both via idempotent bit operations.  s_access and s_mode
are recomputed as the union of the (access, deny) values whose bit
is set, and the entry is freed once s_access_deny_bmap reaches zero.

NLM_UNSHARE gains the access and deny modes as arguments so the
correct bit can be cleared.  The two callers in svcproc.c and
svc4proc.c are updated to forward the decoded values.

Signed-off-by: Oscar Ou &lt;oscarou@synology.com&gt;
Link: https://patch.msgid.link/20260703063856.2423734-1-oscarou@synology.com
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When an NFSv3/NLM client issues multiple NLM_SHARE calls from a single
host for the same (file, owner) tuple, the current implementation
overwrites the recorded access and deny modes with the latest pair.
A subsequent NLM_UNSHARE then drops the entire entry, even if other
grants were implicitly subsumed by the most recent SHARE.  This is
particularly visible to Windows-style clients that map each open of
a file to a distinct NLM_SHARE, all carrying the same NLM owner
handle.  For example:

    1. SHARE(access=RW, deny=W)   -&gt; entry [RW, deny W]
    2. SHARE(access=R,  deny=N)   -&gt; entry [R, deny N]   (RW/W overwritten)
    3. UNSHARE(access=R, deny=N)  -&gt; entry freed
    4. UNSHARE(access=RW, deny=W) -&gt; nothing to release

NLM has no duplicate reply cache, so both SHARE and UNSHARE handlers
must be idempotent under UDP retransmit.

Track each (access, deny) pair with a single bit in a u16 bitmap.
fsh_access and fsh_mode are each in {0..3}, so there are 16 possible
pairs; index = (access &lt;&lt; 2) | deny.  SHARE sets the bit, UNSHARE
clears it, both via idempotent bit operations.  s_access and s_mode
are recomputed as the union of the (access, deny) values whose bit
is set, and the entry is freed once s_access_deny_bmap reaches zero.

NLM_UNSHARE gains the access and deny modes as arguments so the
correct bit can be cleared.  The two callers in svcproc.c and
svc4proc.c are updated to forward the decoded values.

Signed-off-by: Oscar Ou &lt;oscarou@synology.com&gt;
Link: https://patch.msgid.link/20260703063856.2423734-1-oscarou@synology.com
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lockd: Regenerate NLMv4 XDR code</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Chuck Lever</name>
<email>cel@kernel.org</email>
</author>
<published>2026-06-30T15:56:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e1d6e968ee26eee9654e35cd8141e38cefe307a4'/>
<id>e1d6e968ee26eee9654e35cd8141e38cefe307a4</id>
<content type='text'>
The checked-in NLMv4 xdrgen output predates the addition of enum
value validation to generated decoders. As a result the decoders for
fsh4_mode, fsh4_access, and nlm4_stats still accept any 32-bit value,
while the current generator rejects values outside the enumeration.
Resync the generated files with the in-tree xdrgen by regenerating
from the unchanged nlm4.x specification.

This is a plain regeneration with no specification change; it also
refreshes the recorded specification modification time to show that
all existing enum decoders have picked up the xdrgen tool fix.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://patch.msgid.link/20260630155638.874492-1-cel@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The checked-in NLMv4 xdrgen output predates the addition of enum
value validation to generated decoders. As a result the decoders for
fsh4_mode, fsh4_access, and nlm4_stats still accept any 32-bit value,
while the current generator rejects values outside the enumeration.
Resync the generated files with the in-tree xdrgen by regenerating
from the unchanged nlm4.x specification.

This is a plain regeneration with no specification change; it also
refreshes the recorded specification modification time to show that
all existing enum decoders have picked up the xdrgen tool fix.

Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://patch.msgid.link/20260630155638.874492-1-cel@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lockd: fix NLMv4 GRANTED_MSG handling</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Olga Kornievskaia</name>
<email>okorniev@redhat.com</email>
</author>
<published>2026-06-25T21:18:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=88e90d3f7e0251770e52d85c5319f037024b2c59'/>
<id>88e90d3f7e0251770e52d85c5319f037024b2c59</id>
<content type='text'>
GRANTED_MSG is a server-to-client callback, so it runs on the client,
where nfsd never registers nlmsvc_ops. The nlm4svc_lookup_host()
helper is for the server-side request handlers
(TEST/LOCK/CANCEL/UNLOCK), which reach nlmsvc_ops-&gt;fopen and must
reject requests when nfsd isn't running. GRANTED_MSG only calls
nlmclnt_grant(). Instead, of calling nlm4svc_lookup_host(), which
results in a client failing a GRANTED_MSG call, call
nlmsvc_lookup_host().

Fixes: 62721885e861 ("lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_MSG procedure")
Cc: stable@vger.kernel.org
Signed-off-by: Olga Kornievskaia &lt;okorniev@redhat.com&gt;
Reviewed-by: NeilBrown &lt;neil@brown.name&gt;
Link: https://patch.msgid.link/20260625211852.31972-1-okorniev@redhat.com
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GRANTED_MSG is a server-to-client callback, so it runs on the client,
where nfsd never registers nlmsvc_ops. The nlm4svc_lookup_host()
helper is for the server-side request handlers
(TEST/LOCK/CANCEL/UNLOCK), which reach nlmsvc_ops-&gt;fopen and must
reject requests when nfsd isn't running. GRANTED_MSG only calls
nlmclnt_grant(). Instead, of calling nlm4svc_lookup_host(), which
results in a client failing a GRANTED_MSG call, call
nlmsvc_lookup_host().

Fixes: 62721885e861 ("lockd: Use xdrgen XDR functions for the NLMv4 GRANTED_MSG procedure")
Cc: stable@vger.kernel.org
Signed-off-by: Olga Kornievskaia &lt;okorniev@redhat.com&gt;
Reviewed-by: NeilBrown &lt;neil@brown.name&gt;
Link: https://patch.msgid.link/20260625211852.31972-1-okorniev@redhat.com
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lockd: fix swapped arguments in nlmsvc_match_ip()</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Oscar Ou</name>
<email>oscarou@synology.com</email>
</author>
<published>2026-06-17T07:57:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b9060689f49dc663e9a3d069c4a65ff63a836e66'/>
<id>b9060689f49dc663e9a3d069c4a65ff63a836e66</id>
<content type='text'>
When releasing locks by server IP address via /proc/fs/nfsd/unlock_ip,
nlmsvc_unlock_all_by_ip() calls nlm_traverse_files() with the server
sockaddr as the opaque @data argument:

	nlm_traverse_files(server_addr, nlmsvc_match_ip, NULL);

The match callback is later invoked from nlm_traverse_locks() as:

	match(lockhost, host);

where the first argument is the nlm_host that owns the lock, and the
second argument is the @data that was originally passed down (here the
server sockaddr).  This is the convention every other match callback
relies on (nlmsvc_mark_host(), nlmsvc_same_host(), nlmsvc_is_client()):
arg1 is the real nlm_host, arg2 is the caller-supplied reference value.

nlmsvc_match_ip() has had these two arguments reversed ever since the
unlock-by-IP feature was introduced in commit 4373ea84c84d ("lockd:
unlock lockd locks associated with a given server ip"):

	return rpc_cmp_addr(nlm_srcaddr(host), datap);

Here @host is actually the server sockaddr, so nlm_srcaddr(host)
dereferences a struct sockaddr as a struct nlm_host and reads garbage
at the offset of h_srcaddr; meanwhile @datap is actually the lock
owner's nlm_host but is compared as a sockaddr.  As a result the
comparison practically never matches and locks are not released for the
requested IP.

Swap the arguments so the lock owner's source address is compared
against the requested server address:

	return rpc_cmp_addr(nlm_srcaddr(datap), (struct sockaddr *)host);

Fixes: 4373ea84c84d ("lockd: unlock lockd locks associated with a given server ip")
Cc: stable@vger.kernel.org
Signed-off-by: Oscar Ou &lt;oscarou@synology.com&gt;
[ cel: fix the misleading typedef parameter names too ]
Link: https://patch.msgid.link/20260617075738.1151797-1-oscarou@synology.com
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When releasing locks by server IP address via /proc/fs/nfsd/unlock_ip,
nlmsvc_unlock_all_by_ip() calls nlm_traverse_files() with the server
sockaddr as the opaque @data argument:

	nlm_traverse_files(server_addr, nlmsvc_match_ip, NULL);

The match callback is later invoked from nlm_traverse_locks() as:

	match(lockhost, host);

where the first argument is the nlm_host that owns the lock, and the
second argument is the @data that was originally passed down (here the
server sockaddr).  This is the convention every other match callback
relies on (nlmsvc_mark_host(), nlmsvc_same_host(), nlmsvc_is_client()):
arg1 is the real nlm_host, arg2 is the caller-supplied reference value.

nlmsvc_match_ip() has had these two arguments reversed ever since the
unlock-by-IP feature was introduced in commit 4373ea84c84d ("lockd:
unlock lockd locks associated with a given server ip"):

	return rpc_cmp_addr(nlm_srcaddr(host), datap);

Here @host is actually the server sockaddr, so nlm_srcaddr(host)
dereferences a struct sockaddr as a struct nlm_host and reads garbage
at the offset of h_srcaddr; meanwhile @datap is actually the lock
owner's nlm_host but is compared as a sockaddr.  As a result the
comparison practically never matches and locks are not released for the
requested IP.

Swap the arguments so the lock owner's source address is compared
against the requested server address:

	return rpc_cmp_addr(nlm_srcaddr(datap), (struct sockaddr *)host);

Fixes: 4373ea84c84d ("lockd: unlock lockd locks associated with a given server ip")
Cc: stable@vger.kernel.org
Signed-off-by: Oscar Ou &lt;oscarou@synology.com&gt;
[ cel: fix the misleading typedef parameter names too ]
Link: https://patch.msgid.link/20260617075738.1151797-1-oscarou@synology.com
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lockd, nfsd: RCU-protect nlmsvc_ops dispatch</title>
<updated>2026-08-10T13:54:35+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@kernel.org</email>
</author>
<published>2026-06-11T20:00:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=641e5e20852359b8c31149be4598884e30652f60'/>
<id>641e5e20852359b8c31149be4598884e30652f60</id>
<content type='text'>
nlmsvc_ops is published by nfsd_lockd_init() and cleared by
nfsd_lockd_shutdown() with plain stores, while lockd dereferences
it unguarded from dispatch sites in fs/lockd/svcsubs.c. The pointer
targets nfsd's .rodata and the fopen/fclose callbacks live in nfsd's
.text, so a stale load after rmmod nfsd results in either a NULL
deref or a module-text use-after-free.

Declare nlmsvc_ops as __rcu, publish via rcu_assign_pointer(), clear
via RCU_INIT_POINTER() + synchronize_rcu(). Add a struct module
*owner field to nlmsvc_binding and pin the module across indirect
calls with try_module_get/module_put. When the binding is torn down,
fall back to fput() to avoid leaking struct file references.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://patch.msgid.link/20260611-nfsd-testing-v2-16-5b90e276f2d9@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
nlmsvc_ops is published by nfsd_lockd_init() and cleared by
nfsd_lockd_shutdown() with plain stores, while lockd dereferences
it unguarded from dispatch sites in fs/lockd/svcsubs.c. The pointer
targets nfsd's .rodata and the fopen/fclose callbacks live in nfsd's
.text, so a stale load after rmmod nfsd results in either a NULL
deref or a module-text use-after-free.

Declare nlmsvc_ops as __rcu, publish via rcu_assign_pointer(), clear
via RCU_INIT_POINTER() + synchronize_rcu(). Add a struct module
*owner field to nlmsvc_binding and pin the module across indirect
calls with try_module_get/module_put. When the binding is torn down,
fall back to fput() to avoid leaking struct file references.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Link: https://patch.msgid.link/20260611-nfsd-testing-v2-16-5b90e276f2d9@kernel.org
Signed-off-by: Chuck Lever &lt;cel@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
