Author: alc
Date: Sat Nov 24 21:52:10 2018
New Revision: 340914
URL: https://svnweb.freebsd.org/changeset/base/340914

Log:
  blist_meta_alloc assumes that mask=scan->bm_bitmap is nonzero.  But if the
  cursor lies in the middle of the space that the meta node represents, then
  blanking the low bits of mask may make it zero, and break later code that
  expects a nonzero value.  Add a test that returns failure if the mask has
  been cleared.
  
  Submitted by: Doug Moore <do...@rice.edu>
  Reported by:  pho
  Tested by:    pho
  X-MFC with:   r340402
  Differential Revision:        https://reviews.freebsd.org/D18058

Modified:
  head/sys/kern/subr_blist.c

Modified: head/sys/kern/subr_blist.c
==============================================================================
--- head/sys/kern/subr_blist.c  Sat Nov 24 21:23:12 2018        (r340913)
+++ head/sys/kern/subr_blist.c  Sat Nov 24 21:52:10 2018        (r340914)
@@ -764,6 +764,8 @@ blst_meta_alloc(blmeta_t *scan, daddr_t cursor, daddr_
        /* Discard any candidates that appear before cursor. */
        digit = (cursor / radix) & BLIST_META_MASK;
        mask &= (u_daddr_t)-1 << digit;
+       if (mask == 0)
+               return (SWAPBLK_NONE);
 
        /*
         * If the first try is for a block that includes the cursor, pre-undo
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to