]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfsd: Initialize ssc before laundromat_work to prevent NULL dereference
authorLi Lingfeng <lilingfeng3@huawei.com>
Mon, 14 Apr 2025 14:38:52 +0000 (22:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:23 +0000 (11:05 +0100)
commit0fccf5f01ed28725cc313a66ca1247eef911d55e
treefb94ffe48367bd2f88a6053977219d7e2f76b372
parent425efc6b3292a3c79bfee4a1661cf043dcd9cf2f
nfsd: Initialize ssc before laundromat_work to prevent NULL dereference

commit b31da62889e6d610114d81dc7a6edbcaa503fcf8 upstream.

In nfs4_state_start_net(), laundromat_work may access nfsd_ssc through
nfs4_laundromat -> nfsd4_ssc_expire_umount. If nfsd_ssc isn't initialized,
this can cause NULL pointer dereference.

Normally the delayed start of laundromat_work allows sufficient time for
nfsd_ssc initialization to complete. However, when the kernel waits too
long for userspace responses (e.g. in nfs4_state_start_net ->
nfsd4_end_grace -> nfsd4_record_grace_done -> nfsd4_cld_grace_done ->
cld_pipe_upcall -> __cld_pipe_upcall -> wait_for_completion path), the
delayed work may start before nfsd_ssc initialization finishes.

Fix this by moving nfsd_ssc initialization before starting laundromat_work.

Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.")
Cc: stable@vger.kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfssvc.c