From d6f78b132d0cce9af4090f2938771ec9c9e6deb3 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Tue, 25 Jan 2000 14:14:12 +0000 Subject: [PATCH] Bug when dumping a previouslly mapped deleted and not reallocated directory inode. --- CHANGES | 12 +++++++++++- dump/main.c | 18 +++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 77420a6..f83917d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,14 @@ -$Id: CHANGES,v 1.36 2000/01/21 10:33:40 stelian Exp $ +$Id: CHANGES,v 1.37 2000/01/25 14:14:12 stelian Exp $ + +Changes between versions 0.4b13 and 0.4b14 (released ????????????????) +====================================================================== + +1. Fixed a bug in dump which may have caused invalid deleted + directories to be dumped out if they were deleted after the + mapping pass. This could occure on active filesystem and lead + to heap corruption (causing dump malfunction in many possible ways). + Thanks to Jan Sanislo for finding this + bug and submitting the patch. Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000) ====================================================================== diff --git a/dump/main.c b/dump/main.c index 20562bb..cc1ed91 100644 --- a/dump/main.c +++ b/dump/main.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.12 2000/01/21 10:17:41 stelian Exp $"; + "$Id: main.c,v 1.13 2000/01/25 14:14:12 stelian Exp $"; #endif /* not lint */ #include @@ -595,6 +595,11 @@ main(int argc, char *argv[]) if ((dp->di_mode & IFMT) != IFDIR) continue; #ifdef __linux__ + /* + * Skip directory inodes deleted and not yes reallocated... + */ + if (dp->di_nlink == 0 || dp->di_dtime != 0) + continue; (void)dumpdirino(dp, ino); #else (void)dumpino(dp, ino); @@ -603,8 +608,6 @@ main(int argc, char *argv[]) msg("dumping (Pass IV) [regular files]\n"); for (map = dumpinomap, ino = 1; ino < maxino; ino++) { - int mode; - if (((ino - 1) % NBBY) == 0) /* map is offset by 1 */ dirty = *map++; else @@ -615,9 +618,14 @@ main(int argc, char *argv[]) * Skip inodes deleted and reallocated as directories. */ dp = getino(ino); - mode = dp->di_mode & IFMT; - if (mode == IFDIR) + if ((dp->di_mode & IFMT) == IFDIR) continue; +#ifdef __linux__ + /* + * No need to check here for deleted and not yes reallocated inodes + * since this is done in dumpino(). + */ +#endif (void)dumpino(dp, ino); } -- 2.39.2