svn commit: r322897 - head/sys/kern
Alan Cox
alc at FreeBSD.org
Fri Aug 25 18:47:25 UTC 2017
Author: alc
Date: Fri Aug 25 18:47:23 2017
New Revision: 322897
URL: https://svnweb.freebsd.org/changeset/base/322897
Log:
Correct a regression in the previous change, r322459. Specifically, the
removal of the "blk" parameter from blst_meta_alloc() had the unintended
effect of generating an out-of-range allocation when the cursor reaches
the end of the tree if the number of managed blocks in the tree equals
the so-called "radix" (which in the blist code is not the standard notion
of what a radix is but rather the maximum number of leaves in a tree of
the current height.) In other words, only certain swap configurations
were affected, which is why earlier testing did not reveal the problem.
Submitted by: Doug Moore <dougm at rice.edu>
Reported by: pho, kib
Tested by: pho
X-MFC with: r322459
Differential Revision: https://reviews.freebsd.org/D12106
Modified:
head/sys/kern/subr_blist.c
Modified: head/sys/kern/subr_blist.c
==============================================================================
--- head/sys/kern/subr_blist.c Fri Aug 25 17:29:48 2017 (r322896)
+++ head/sys/kern/subr_blist.c Fri Aug 25 18:47:23 2017 (r322897)
@@ -251,6 +251,8 @@ blist_alloc(blist_t bl, daddr_t count)
bl->bl_radix);
if (blk != SWAPBLK_NONE) {
bl->bl_cursor = blk + count;
+ if (bl->bl_cursor == bl->bl_blocks)
+ bl->bl_cursor = 0;
return (blk);
} else if (bl->bl_cursor != 0)
bl->bl_cursor = 0;
More information about the svn-src-all
mailing list