From: J. Bruce Fields Date: Wed, 5 Aug 2020 19:10:11 +0000 (-0400) Subject: nfsd: fix oops on mixed NFSv4/NFSv3 client access X-Git-Tag: v5.8.6~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2655c17ee2e5118cd41e394c3c4dc8e07caaee8;p=thirdparty%2Fkernel%2Fstable.git nfsd: fix oops on mixed NFSv4/NFSv3 client access [ Upstream commit 34b09af4f54e6485e28f138ccad159611a240cc1 ] If an NFSv2/v3 client breaks an NFSv4 client's delegation, it will hit a NULL dereference in nfsd_breaker_owns_lease(). Easily reproduceable with for example mount -overs=4.2 server:/export /mnt/ sleep 1h Fixes: 28df3d1539de50 ("nfsd: clients don't need to break their own delegations") BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208807 Signed-off-by: J. Bruce Fields Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c9056316a0b35..cea682ce8aa12 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -4597,6 +4597,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl) if (!i_am_nfsd()) return NULL; rqst = kthread_data(current); + if (!rqst->rq_lease_breaker) + return NULL; clp = *(rqst->rq_lease_breaker); return dl->dl_stid.sc_client == clp; }