Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/msdosfs Add a sanity check if secsize returned from g...



details:   https://anonhg.NetBSD.org/src/rev/904ebaf9b650
branches:  trunk
changeset: 779943:904ebaf9b650
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 30 11:01:41 2012 +0000

description:
Add a sanity check if secsize returned from getdisksize() isn't bogus.
This prevent possible panic "panic: buf mem pool index 23" later in
vfs_bio.c:buf_mempoolidx().
(I'm not sure if it's okay for getdisksize() to assume that
 partinfo taken from DIOCGPART is properly initialized
 on all disk(9) devices or not)

See also:
http://mail-index.NetBSD.org/source-changes/2012/06/30/msg035298.html

diffstat:

 sys/fs/msdosfs/msdosfs_vfsops.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r a0dfe5825ce1 -r 904ebaf9b650 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Sat Jun 30 10:52:31 2012 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Sat Jun 30 11:01:41 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.94 2012/03/13 18:40:37 elad Exp $ */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.95 2012/06/30 11:01:41 tsutsui Exp $      */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.94 2012/03/13 18:40:37 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.95 2012/06/30 11:01:41 tsutsui Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -493,7 +493,7 @@
                goto error_exit;
 
        error = getdisksize(devvp, &psize, &secsize);
-       if (error) {
+       if (error || secsize == 0) {
                if (argp->flags & MSDOSFSMNT_GEMDOSFS)
                        goto error_exit;
 



Home | Main Index | Thread Index | Old Index