fileserver-may-not-have-valid-diskDataHandle-if-volume-was-offlined-20021003
authorDerrick Brashear <shadow@dementia.org>
Thu, 3 Oct 2002 22:24:08 +0000 (22:24 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 3 Oct 2002 22:24:08 +0000 (22:24 +0000)
also avoid potential null deref in ih_open but with the ReadVolumeHeader patch
we should never get there.

thanks to Kris Van Hees for discovering this

src/vol/ihandle.c
src/vol/volume.c

index 78defc2..cfd7614 100644 (file)
@@ -264,6 +264,9 @@ FdHandle_t *ih_open(IHandle_t *ihP)
     FD_t fd;
     FD_t closeFd;
 
+    if (!ihP) /* XXX should log here in the fileserver */
+       return NULL;
+
     IH_LOCK
 
     /* Do we already have an open file handle for this Inode? */
index 4394ffd..77b8236 100644 (file)
@@ -388,6 +388,11 @@ static void ReadHeader(Error *ec, IHandle_t *h, char *to, int size,
     FdHandle_t *fdP;
 
     *ec = 0;
+    if (h == NULL) {
+       *ec = VSALVAGE;
+       return;
+    }
+
     fdP = IH_OPEN(h);
     if (fdP == NULL) {
        *ec = VSALVAGE;