NFSD: Fix a null reference case in find_or_create_lock_stateid()
[firefly-linux-kernel-4.4.55.git] / fs / nfsd / nfs4layouts.c
index c9d6c715c0fb7e3187ffd1f2105f9527aa32259b..9eed219f57a54d8f5c00f6772bfec6510ed358fe 100644 (file)
@@ -189,10 +189,11 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate,
        struct nfs4_layout_stateid *ls;
        struct nfs4_stid *stp;
 
-       stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache);
+       stp = nfs4_alloc_stid(cstate->clp, nfs4_layout_stateid_cache,
+                                       nfsd4_free_layout_stateid);
        if (!stp)
                return NULL;
-       stp->sc_free = nfsd4_free_layout_stateid;
+
        get_nfs4_file(fp);
        stp->sc_file = fp;