nfsd: fix nfsd4_deleg_getattr_conflict in presence of third party lease
authorNeilBrown <neilb@suse.de>
Wed, 28 Aug 2024 23:06:28 +0000 (09:06 +1000)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 30 Aug 2024 14:48:29 +0000 (10:48 -0400)
commit40927f3d0972bf86357a32a5749be71a551241b6
treea3976040195a7c51a63109716348d3709e6da840
parent7e8ae8486e4471513e2111aba6ac29f2357bed2a
nfsd: fix nfsd4_deleg_getattr_conflict in presence of third party lease

It is not safe to dereference fl->c.flc_owner without first confirming
fl->fl_lmops is the expected manager.  nfsd4_deleg_getattr_conflict()
tests fl_lmops but largely ignores the result and assumes that flc_owner
is an nfs4_delegation anyway.  This is wrong.

With this patch we restore the "!= &nfsd_lease_mng_ops" case to behave
as it did before the change mentioned below.  This is the same as the
current code, but without any reference to a possible delegation.

Fixes: c5967721e106 ("NFSD: handle GETATTR conflict with write delegation")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c