[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150417132515.962467664@linuxfoundation.org>
Date: Fri, 17 Apr 2015 15:28:24 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Trond Myklebust <trond.myklebust@...marydata.com>,
Christoph Hellwig <hch@...radead.org>,
Christoph Hellwig <hch@....de>,
Jeff Layton <jeff.layton@...marydata.com>,
"J. Bruce Fields" <bfields@...hat.com>
Subject: [PATCH 3.19 036/101] nfsd: return correct openowner when there is a race to put one in the hash
3.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <jlayton@...chiereds.net>
commit c5952338bfc234e54deda45b7228f610a545e28a upstream.
alloc_init_open_stateowner can return an already freed entry if there is
a race to put openowners in the hashtable.
In commit 7ffb588086e9, we changed it so that we allocate and initialize
an openowner, and then check to see if a matching one got stuffed into
the hashtable in the meantime. If it did, then we free the one we just
allocated and take a reference on the one already there. There is a bug
here though. The code will then return the pointer to the one that was
allocated (and has now been freed).
This wasn't evident before as this race almost never occurred. The Linux
kernel client used to serialize requests for a single openowner. That
has changed now with v4.0 kernels, and this race can now easily occur.
Fixes: 7ffb588086e9
Cc: Trond Myklebust <trond.myklebust@...marydata.com>
Reported-by: Christoph Hellwig <hch@...radead.org>
Reviewed-by: Christoph Hellwig <hch@....de>
Signed-off-by: Jeff Layton <jeff.layton@...marydata.com>
Signed-off-by: J. Bruce Fields <bfields@...hat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/nfsd/nfs4state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3228,7 +3228,7 @@ alloc_init_open_stateowner(unsigned int
} else
nfs4_free_openowner(&oo->oo_owner);
spin_unlock(&clp->cl_lock);
- return oo;
+ return ret;
}
static void init_open_stateid(struct nfs4_ol_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *open) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists