svn commit: r273143 - head/sys/kern

Alexander Motin mav at FreeBSD.org
Wed Oct 15 18:36:35 UTC 2014


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);
-	}
 }
 
 /*


More information about the svn-src-all mailing list