If no enough buffer space available, but idmap_lookup have triggered lookup_fn which calls cache_get and returns successfully. Then we missed to call cache_put here which pairs with cache_get. Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> --- fs/nfsd/nfs4idmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index 7a806ac13e31..7abddf7d8f6d 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c @@ -594,8 +594,10 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr, ret = strlen(item->name); WARN_ON_ONCE(ret > IDMAP_NAMESZ); p = xdr_reserve_space(xdr, ret + 4); - if (!p) + if (!p) { + cache_put(&item->h, nn->idtoname_cache); return nfserr_resource; + } p = xdr_encode_opaque(p, item->name, ret); cache_put(&item->h, nn->idtoname_cache); return 0; -- 2.35.3