From: Andrew Deason Date: Tue, 1 Oct 2013 22:31:44 +0000 (-0500) Subject: namei: Set inconsistent linktable linkCount to 0 X-Git-Tag: openafs-stable-1_8_0pre1~971 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=2286fac1447e2e9e834957ec414cb5605f51e63b namei: Set inconsistent linktable linkCount to 0 Currently, if we detect an inconsistent linktable filename (where the filename indicates it's for a different volume than the directory path indicates), we don't set the linkCount for the inode info. This means that our caller will get random garbage for the linkCount. In many cases this value is ignored, but for the salvager, if this is the only linktable file we find, we treat it as the linktable we should be using. Thus, if linkCount contains undefined data, we might try to INC or DEC the linktable a bunch of times, depending on what random stack garbage the linkCount is filled with. The salvager shouldn't be INC/DEC'ing these linktables according to the their linkCount anyway, but in the meantime, at least ensure that this doesn't contain stack garbage, so we ensure that we won't try to INC or DEC this thousands or millions of times. Change-Id: Ib5e7f45d5739878434cbe57b6f2ab532f002e5b8 Reviewed-on: http://gerrit.openafs.org/10320 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index c5ea7ae..4e845b6 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1997,6 +1997,11 @@ _namei_examine_special(char * path1, "(dir_vgid=%" AFS_VOLID_FMT ", inode_vgid=%" AFS_VOLID_FMT ")\n", path1, dname, afs_printable_VolumeId_lu(myIH->ih_vid), afs_printable_VolumeId_lu(info.u.param[0])); + /* We need to set the linkCount to _something_, so linkCount + * doesn't just contain stack garbage. Set it to 0, so in case + * the salvager or whatever our caller is does try to process + * this like a normal file, we won't try to INC or DEC it. */ + info.linkCount = 0; } else { char path2[512]; /* Open this handle */