summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Coddington <bcodding@redhat.com>2015-11-20 09:56:20 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-11-23 21:59:42 -0500
commitc68a027c05709330fe5b2f50c50d5fa02124b5d8 (patch)
tree42a72e774e63306c52ecd51d9c2314209a50bed0
parent91ab4b4d16e6649fbbf65f303c0c4e20ed680bd1 (diff)
downloadlinux-c68a027c05709330fe5b2f50c50d5fa02124b5d8.tar.gz
linux-c68a027c05709330fe5b2f50c50d5fa02124b5d8.tar.bz2
linux-c68a027c05709330fe5b2f50c50d5fa02124b5d8.zip
nfs4: start callback_ident at idr 1
If clp->cl_cb_ident is zero, then nfs_cb_idr_remove_locked() skips removing it when the nfs_client is freed. A decoding or server bug can then find and try to put that first nfs_client which would lead to a crash. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Fixes: d6870312659d ("nfs4client: convert to idr_alloc()") Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/nfs4client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 223bedda64ae..10410e8b5853 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -33,7 +33,7 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion)
return ret;
idr_preload(GFP_KERNEL);
spin_lock(&nn->nfs_client_lock);
- ret = idr_alloc(&nn->cb_ident_idr, clp, 0, 0, GFP_NOWAIT);
+ ret = idr_alloc(&nn->cb_ident_idr, clp, 1, 0, GFP_NOWAIT);
if (ret >= 0)
clp->cl_cb_ident = ret;
spin_unlock(&nn->nfs_client_lock);