]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFSD fixing possible null pointer derefering in copy offload
authorOlga Kornievskaia <olga.kornievskaia@gmail.com>
Wed, 4 Dec 2019 20:13:54 +0000 (15:13 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 9 Dec 2019 16:44:07 +0000 (11:44 -0500)
Static checker revealed possible error path leading to possible
NULL pointer dereferencing.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 65b59d4873ed: ("NFSD introduce async copy feature")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c

index d012f0894fabe3037e3a3799691a8aaa35195b3b..d33c39c18cdd7222953ac7d5733ee2c11b72861f 100644 (file)
@@ -1446,7 +1446,8 @@ static void cleanup_async_copy(struct nfsd4_copy *copy)
 {
        nfs4_free_copy_state(copy);
        nfsd_file_put(copy->nf_dst);
-       nfsd_file_put(copy->nf_src);
+       if (copy->cp_intra)
+               nfsd_file_put(copy->nf_src);
        spin_lock(&copy->cp_clp->async_lock);
        list_del(&copy->copies);
        spin_unlock(&copy->cp_clp->async_lock);