Author: mav
Date: Wed Oct 15 18:36:34 2014
New Revision: 273143
URL: https://svnweb.freebsd.org/changeset/base/273143

Log:
  Remove setting BIO_DONE flag for BIOs that have done() method.
  
  This fixes use-after-free, caused by geom_disk, completing same BIO twice
  to save extra allocation, and getting BIO_DONE set after the first.
  
  MFC after:    1 week

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c     Wed Oct 15 17:55:10 2014        (r273142)
+++ head/sys/kern/vfs_bio.c     Wed Oct 15 18:36:34 2014        (r273143)
@@ -3618,10 +3618,8 @@ biodone(struct bio *bp)
                bp->bio_flags |= BIO_DONE;
                wakeup(bp);
                mtx_unlock(mtxp);
-       } else {
-               bp->bio_flags |= BIO_DONE;
+       } else
                done(bp);
-       }
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to