From: Benjamin Coddington Date: Fri, 20 Nov 2015 14:56:20 +0000 (-0500) Subject: nfs4: start callback_ident at idr 1 X-Git-Tag: v4.1.12-92~201^2~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=429ef663c1ec2f81487a760dd9e12b764deb1d0a;p=users%2Fjedix%2Flinux-maple.git nfs4: start callback_ident at idr 1 Orabug: 22623874 commit c68a027c05709330fe5b2f50c50d5fa02124b5d8 upstream. 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 Fixes: d6870312659d ("nfs4client: convert to idr_alloc()") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 254cbeb139be712a9dbcfcaea997a3e3dfd9be52) Signed-off-by: Dan Duval --- diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index e42be52a8c18d..5dea913baf46c 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);