]> git.baikalelectronics.ru Git - kernel.git/commit
NFSv4: Fix races in the legacy idmapper upcall
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 13 Jul 2022 21:46:52 +0000 (17:46 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:22 +0000 (11:18 +0200)
commit0c6a41004ef0f16edbb971968e59db45beebed4e
tree10ac2cb01658859d07af6121aec3b5ee8d1f3389
parentf567804618c07ba94cbc7e3e693f84243f146bc8
NFSv4: Fix races in the legacy idmapper upcall

commit 07aa86791bb275b414423822d255f53a46e365c3 upstream.

nfs_idmap_instantiate() will cause the process that is waiting in
request_key_with_auxdata() to wake up and exit. If there is a second
process waiting for the idmap->idmap_mutex, then it may wake up and
start a new call to request_key_with_auxdata(). If the call to
idmap_pipe_downcall() from the first process has not yet finished
calling nfs_idmap_complete_pipe_upcall_locked(), then we may end up
triggering the WARN_ON_ONCE() in nfs_idmap_prepare_pipe_upcall().

The fix is to ensure that we clear idmap->idmap_upcall_data before
calling nfs_idmap_instantiate().

Fixes: 688d6a353ba0 ("NFSv4: Clean up the legacy idmapper upcall")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/nfs4idmap.c