summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpedro <pedro@openbsd.org>2007-03-14 13:56:42 +0000
committerpedro <pedro@openbsd.org>2007-03-14 13:56:42 +0000
commit72a2b703ff6968b102fc5c724f6867bf540560d1 (patch)
treee785e342da7293c0b5d52daaa303da2f0111d5b8
parentWe switched to aes cbc quite some time ago, so also use the correct (diff)
downloadwireguard-openbsd-72a2b703ff6968b102fc5c724f6867bf540560d1.tar.xz
wireguard-openbsd-72a2b703ff6968b102fc5c724f6867bf540560d1.zip
Check if there are still blocks left to be allocated _after_ we have
read in the bitmap (an operation that might cause us to sleep), and before committing to the allocation. Fixes PR 5230, okay krw@, millert@.
-rw-r--r--sys/ufs/ext2fs/ext2fs_alloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c
index 7992ff86ca2..25e41ea6fba 100644
--- a/sys/ufs/ext2fs/ext2fs_alloc.c
+++ b/sys/ufs/ext2fs/ext2fs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_alloc.c,v 1.20 2005/12/11 20:46:28 pedro Exp $ */
+/* $OpenBSD: ext2fs_alloc.c,v 1.21 2007/03/14 13:56:42 pedro Exp $ */
/* $NetBSD: ext2fs_alloc.c,v 1.10 2001/07/05 08:38:27 toshii Exp $ */
/*
@@ -341,7 +341,7 @@ ext2fs_alloccg(ip, cg, bpref, size)
error = bread(ip->i_devvp, fsbtodb(fs,
fs->e2fs_gd[cg].ext2bgd_b_bitmap),
(int)fs->e2fs_bsize, NOCRED, &bp);
- if (error) {
+ if (error || fs->e2fs_gd[cg].ext2bgd_nbfree == 0) {
brelse(bp);
return (0);
}