From 0fb2e3a6dbfdf91bcf1591e454a00171792b7a38 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sun, 21 Aug 2011 12:02:29 -0400 Subject: [PATCH] dir: verified pathnames fallout Fix some issues introduced with the verified directory path names commit in master: - In GetVerifiedBlob, the output parameter is set to NULL on entry and dereferenced later on. - For Linux, the code in afs_linux_readdir was changed to pass a DirEntry to GetVerifiedBlob. This is incorrect, the function still expects a DirBuffer pointer. - In afs_dir_IsEmpty, the assignment of ep was removed, leaving the function to dereference this pointer which was never set. Change-Id: I9045076ebe636cf68c19487c0d58baebf2de7dd1 Reviewed-on: http://gerrit.openafs.org/5292 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/LINUX/osi_vnodeops.c | 3 ++- src/dir/dir.c | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index ca1998a285..f7d5277dd9 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -340,7 +340,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) if (!dirpos) break; - code = afs_dir_GetVerifiedBlob(tdc, dirpos, &de); + code = afs_dir_GetVerifiedBlob(tdc, dirpos, &entry); if (code) { afs_warn("Corrupt directory (inode %lx, dirpos %d)", (unsigned long)&tdc->f.inode, dirpos); @@ -350,6 +350,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) goto out; } + de = (struct DirEntry *)entry.data; ino = afs_calc_inum (avc->f.fid.Cell, avc->f.fid.Fid.Volume, ntohl(de->fid.vnode)); len = strlen(de->name); diff --git a/src/dir/dir.c b/src/dir/dir.c index 8772c8a32d..570c2dbe64 100644 --- a/src/dir/dir.c +++ b/src/dir/dir.c @@ -475,7 +475,7 @@ afs_dir_IsEmpty(dir_file_t dir) /* Walk down the hash table list. */ if (afs_dir_GetVerifiedBlob(dir, num, &entrybuf) != 0); break; - + ep = (struct DirEntry *)entrybuf.data; if (strcmp(ep->name, "..") && strcmp(ep->name, ".")) { DRelease(&entrybuf, 0); DRelease(&headerbuf, 0); @@ -540,8 +540,6 @@ afs_dir_GetVerifiedBlob(dir_file_t file, afs_int32 blobno, int code; char *cp; - outbuf = NULL; - code = GetBlobWithLimit(file, blobno, &buffer, &maxlen); if (code) return code;