| From 87f26c73efdcaa40b1a1823c84329818fae37a2d Mon Sep 17 00:00:00 2001 |
| From: Trond Myklebust <trondmy@gmail.com> |
| Date: Thu, 31 Oct 2019 18:40:33 -0400 |
| Subject: [PATCH] NFS: Fix an RCU lock leak in |
| nfs4_refresh_delegation_stateid() |
| |
| commit 79cc55422ce99be5964bde208ba8557174720893 upstream. |
| |
| A typo in nfs4_refresh_delegation_stateid() means we're leaking an |
| RCU lock, and always returning a value of 'false'. As the function |
| description states, we were always supposed to return 'true' if a |
| matching delegation was found. |
| |
| Fixes: 12f275cdd163 ("NFSv4: Retry CLOSE and DELEGRETURN on NFS4ERR_OLD_STATEID.") |
| Cc: stable@vger.kernel.org # v4.15+ |
| Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> |
| Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c |
| index 071b90a45933..ad7a77101471 100644 |
| --- a/fs/nfs/delegation.c |
| +++ b/fs/nfs/delegation.c |
| @@ -1181,7 +1181,7 @@ bool nfs4_refresh_delegation_stateid(nfs4_stateid *dst, struct inode *inode) |
| if (delegation != NULL && |
| nfs4_stateid_match_other(dst, &delegation->stateid)) { |
| dst->seqid = delegation->stateid.seqid; |
| - return ret; |
| + ret = true; |
| } |
| rcu_read_unlock(); |
| out: |
| -- |
| 2.7.4 |
| |