]> Git Repo - linux.git/commitdiff
nfsd: fix oops on mixed NFSv4/NFSv3 client access
authorJ. Bruce Fields <[email protected]>
Wed, 5 Aug 2020 19:10:11 +0000 (15:10 -0400)
committerChuck Lever <[email protected]>
Sun, 16 Aug 2020 20:51:18 +0000 (16:51 -0400)
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 </mnt/file &
mount -overs=3 server:/export /mnt2/
touch /mnt2/file

Reported-by: Robert Dinse <[email protected]>
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 <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
fs/nfsd/nfs4state.c

index 81ed8e8bab3fc786561580f2b752af2919e9208e..1ea9bbcc7c24818f88e34b6a4a460b3b5b557cca 100644 (file)
@@ -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;
 }
This page took 0.06299 seconds and 4 git commands to generate.