Skip to content

Commit c68a027

Browse files
bcodding-rhtrondmypd
authored andcommitted
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: d687031 ("nfs4client: convert to idr_alloc()") Cc: stable@vger.kernel.org Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
1 parent 91ab4b4 commit c68a027

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/nfs/nfs4client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion)
3333
return ret;
3434
idr_preload(GFP_KERNEL);
3535
spin_lock(&nn->nfs_client_lock);
36-
ret = idr_alloc(&nn->cb_ident_idr, clp, 0, 0, GFP_NOWAIT);
36+
ret = idr_alloc(&nn->cb_ident_idr, clp, 1, 0, GFP_NOWAIT);
3737
if (ret >= 0)
3838
clp->cl_cb_ident = ret;
3939
spin_unlock(&nn->nfs_client_lock);

0 commit comments

Comments
 (0)