From c6da165252c61a2328837d13c4463026d47a45c0 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 3 Oct 2002 22:24:08 +0000 Subject: [PATCH] fileserver-may-not-have-valid-diskDataHandle-if-volume-was-offlined-20021003 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 | 3 +++ src/vol/volume.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index 78defc299..cfd761476 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -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? */ diff --git a/src/vol/volume.c b/src/vol/volume.c index 4394ffd5c..77b823672 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -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; -- 2.39.5