Module Name: src
Committed By: martin
Date: Wed Jan 5 19:34:28 UTC 2011
Modified Files:
src/sys/ufs/lfs: lfs_vnops.c
Log Message:
Avoid NULL deref inside a KASSERT, as discussed on tech-kern.
To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/ufs/lfs/lfs_vnops.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/ufs/lfs/lfs_vnops.c
diff -u src/sys/ufs/lfs/lfs_vnops.c:1.233 src/sys/ufs/lfs/lfs_vnops.c:1.234
--- src/sys/ufs/lfs/lfs_vnops.c:1.233 Sun Jan 2 05:09:32 2011
+++ src/sys/ufs/lfs/lfs_vnops.c Wed Jan 5 19:34:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.233 2011/01/02 05:09:32 dholland Exp $ */
+/* $NetBSD: lfs_vnops.c,v 1.234 2011/01/05 19:34:27 martin Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.233 2011/01/02 05:09:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.234 2011/01/05 19:34:27 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1860,7 +1860,8 @@
* blocks outside our area of interest or beyond
* the end of file.
*/
- KASSERT((curpg->flags & PG_MARKER) == 0);
+ KASSERT(curpg == NULL
+ || (curpg->flags & PG_MARKER) == 0);
if (pages_per_block > 1) {
while (curpg &&
((curpg->offset & fs->lfs_bmask) ||