Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/dumplfs If the number of inodes per block is zero, ...
details: https://anonhg.NetBSD.org/src/rev/dca25d664afc
branches: trunk
changeset: 817213:dca25d664afc
user: dholland <dholland%NetBSD.org@localhost>
date: Fri Aug 12 08:22:13 2016 +0000
description:
If the number of inodes per block is zero, bail instead of using
uninitialized stack trash as a dinode pointer. Fixes PR 51409 where
"dumplfs /dev/zero" receives SIGSEGV.
diffstat:
usr.sbin/dumplfs/dumplfs.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (38 lines):
diff -r 9c77adb0e96d -r dca25d664afc usr.sbin/dumplfs/dumplfs.c
--- a/usr.sbin/dumplfs/dumplfs.c Fri Aug 12 03:17:41 2016 +0000
+++ b/usr.sbin/dumplfs/dumplfs.c Fri Aug 12 08:22:13 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dumplfs.c,v 1.62 2016/06/15 14:07:54 riastradh Exp $ */
+/* $NetBSD: dumplfs.c,v 1.63 2016/08/12 08:22:13 dholland Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)dumplfs.c 8.5 (Berkeley) 5/24/95";
#else
-__RCSID("$NetBSD: dumplfs.c,v 1.62 2016/06/15 14:07:54 riastradh Exp $");
+__RCSID("$NetBSD: dumplfs.c,v 1.63 2016/08/12 08:22:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -336,12 +336,19 @@
err(1, "malloc");
get(fd, fsbtobyte(lfsp, addr), dpage, psize);
+ dip = NULL;
for (i = LFS_INOPB(lfsp); i-- > 0; ) {
dip = DINO_IN_BLOCK(lfsp, dpage, i);
if (lfs_dino_getinumber(lfsp, dip) == LFS_IFILE_INUM)
break;
}
+ /* just in case */
+ if (dip == NULL) {
+ warnx("this volume apparently has zero inodes per block");
+ return;
+ }
+
if (lfs_dino_getinumber(lfsp, dip) != LFS_IFILE_INUM) {
warnx("unable to locate ifile inode at disk address 0x%jx",
(uintmax_t)addr);
Home |
Main Index |
Thread Index |
Old Index