Module Name:    src
Committed By:   snj
Date:           Tue Mar 31 23:06:13 UTC 2009

Modified Files:
        src/sys/fs/udf [netbsd-5]: udf_allocation.c

Log Message:
Pull up following revision(s) (requested by reinoud in ticket #610):
        sys/fs/udf/udf_allocation.c: revision 1.20
Fix possible overshoot when allocating from a space bitmap when ffs(3) returns
a too big offset for the bitmap.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.4.1 src/sys/fs/udf/udf_allocation.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/udf/udf_allocation.c
diff -u src/sys/fs/udf/udf_allocation.c:1.18 src/sys/fs/udf/udf_allocation.c:1.18.4.1
--- src/sys/fs/udf/udf_allocation.c:1.18	Fri Aug 29 15:04:18 2008
+++ src/sys/fs/udf/udf_allocation.c	Tue Mar 31 23:06:13 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_allocation.c,v 1.18 2008/08/29 15:04:18 reinoud Exp $ */
+/* $NetBSD: udf_allocation.c,v 1.18.4.1 2009/03/31 23:06:13 snj Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.18 2008/08/29 15:04:18 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_allocation.c,v 1.18.4.1 2009/03/31 23:06:13 snj Exp $");
 #endif /* not lint */
 
 
@@ -827,6 +827,13 @@
 				offset += 8;
 				continue;
 			}
+
+			/* check for ffs overshoot */
+			if (offset + bit-1 >= bitmap->max_offset) {
+				offset = bitmap->max_offset;
+				break;
+			}
+
 			DPRINTF(PARANOIA, ("XXX : allocate %d, %p, bit %d\n",
 				offset + bit -1, bpos, bit-1));
 			*bpos &= ~(1 << (bit-1));

Reply via email to