summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-12-04 08:59:36 +0100
committerJ. Bruce Fields <bfields@redhat.com>2019-12-09 17:44:07 +0100
commit5277a79e2dee458f0185e4ebde1cd4e128f014e9 (patch)
treee3a0114a1f3d6cf6e50f1c8f11c441c40ae1216a /fs/nfsd
parentNFSD add nfs4 inter ssc to nfsd4_copy (diff)
downloadlinux-5277a79e2dee458f0185e4ebde1cd4e128f014e9.tar.xz
linux-5277a79e2dee458f0185e4ebde1cd4e128f014e9.zip
nfsd: unlock on error in manage_cpntf_state()
We are holding the "nn->s2s_cp_lock" so we can't return directly without unlocking first. Fixes: f3dee17721a0 ("NFSD check stateids against copy stateids") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 296765e693d0..390ad454a229 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5695,13 +5695,16 @@ __be32 manage_cpntf_state(struct nfsd_net *nn, stateid_t *st,
if (cps_t) {
state = container_of(cps_t, struct nfs4_cpntf_state,
cp_stateid);
- if (state->cp_stateid.sc_type != NFS4_COPYNOTIFY_STID)
- return nfserr_bad_stateid;
+ if (state->cp_stateid.sc_type != NFS4_COPYNOTIFY_STID) {
+ state = NULL;
+ goto unlock;
+ }
if (!clp)
refcount_inc(&state->cp_stateid.sc_count);
else
_free_cpntf_state_locked(nn, state);
}
+unlock:
spin_unlock(&nn->s2s_cp_lock);
if (!state)
return nfserr_bad_stateid;