mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
NFSD: Fix off-by-one in DRC bucket pruning limit
nfsd_prune_bucket_locked() evicts an entry before checking
the freed count against @max. The check uses "++freed > max",
which does not break until freed exceeds max, resulting in
max + 1 evictions. Use ">=" so the limit stated in the
function comment is honored.
Fixes: a9507f6af1 ("NFSD: Replace nfsd_prune_bucket()")
Cc: stable@vger.kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Link: https://patch.msgid.link/20260717001232.438792-2-cel@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
This commit is contained in:
parent
1c0d8861c0
commit
d0728723c8
|
|
@ -277,7 +277,7 @@ nfsd_prune_bucket_locked(struct nfsd_net *nn, struct nfsd_drc_bucket *b,
|
|||
nfsd_cacherep_unlink_locked(nn, b, rp);
|
||||
list_add(&rp->c_lru, dispose);
|
||||
|
||||
if (max && ++freed > max)
|
||||
if (max && ++freed >= max)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user