Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ffs ffs_superblock_validate(): ensure fs->fs_cssize!...



details:   https://anonhg.NetBSD.org/src/rev/e1204dbc93dd
branches:  trunk
changeset: 336114:e1204dbc93dd
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Feb 13 17:13:20 2015 +0000

description:
ffs_superblock_validate(): ensure fs->fs_cssize!=0, otherwise the kernel
panics with kmem_alloc(0).

diffstat:

 sys/ufs/ffs/ffs_vfsops.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 40147d0ad0fa -r e1204dbc93dd sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Fri Feb 13 16:59:52 2015 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Fri Feb 13 17:13:20 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.308 2015/02/13 16:59:52 maxv Exp $    */
+/*     $NetBSD: ffs_vfsops.c,v 1.309 2015/02/13 17:13:20 maxv Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.308 2015/02/13 16:59:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.309 2015/02/13 17:13:20 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -923,6 +923,8 @@
 
        if (fs->fs_size == 0)
                return 0;
+       if (fs->fs_cssize == 0)
+               return 0;
 
        /* Block size cannot be smaller than fragment size */
        if (fs_bsize < fs->fs_fsize)



Home | Main Index | Thread Index | Old Index