aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2014-10-15 18:36:34 +0000
committerAlexander Motin <mav@FreeBSD.org>2014-10-15 18:36:34 +0000
commit99b9076c210de967b6a9a34209b53285a8e64b3b (patch)
treeb105a1f089c1b156f684716401f383c02f96eb9c /sys/kern/vfs_bio.c
parent632d4e706a116048816d53cdc1d66b915673bf93 (diff)
downloadsrc-99b9076c210de967b6a9a34209b53285a8e64b3b.tar.gz
src-99b9076c210de967b6a9a34209b53285a8e64b3b.zip
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
Notes
Notes: svn path=/head/; revision=273143
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 19feecd4b5e6..995ab5be6156 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -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);
- }
}
/*