]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-linux-avoid-returning-invalid-pointers-on-error-20090402
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Mon, 6 Apr 2009 23:50:44 +0000 (23:50 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 6 Apr 2009 23:50:44 +0000 (23:50 +0000)
LICENSE IPL10
FIXES 124580

avoid returning a positive error as it will look like a pointer.

src/afs/LINUX/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_lookup.c

index e4732feb6563ee4f2544aa0c800ab4a1139929dc..8bdc92334e6eac8929f96558003b18ec023dfa1c 100644 (file)
@@ -1087,8 +1087,10 @@ afs_linux_lookup(struct inode *dip, struct dentry *dp)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,10)
     if (code == ENOENT)
        return ERR_PTR(0);
-    else
+    else if ((code >= 0) && (code <= MAX_ERRNO))
        return ERR_PTR(-code);
+    else 
+       return ERR_PTR(-EIO);
 #else
     if (code == ENOENT)
        code = 0;
@@ -1429,7 +1431,10 @@ afs_linux_follow_link(struct dentry *dp, struct dentry *basep,
 
     if (code < 0) {
        dput(basep);
-       res = ERR_PTR(code);
+       if (code < -MAX_ERRNO)
+           res = ERR_PTR(-EIO);
+       else
+           res = ERR_PTR(code);
     } else {
        name[code] = '\0';
        res = lookup_dentry(name, basep, follow);
index 4bf72b5ffdd87d39bbf3d1a0680e584fa50fed2d..0d2d8dc71cb6fbe629c5c1e767041a26b7404874 100644 (file)
@@ -1081,7 +1081,7 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
        afs_PutVolume(volp, READ_LOCK);
 
     /* If we did the InlineBulk RPC pull out the return code */
-    if (inlinebulk) {
+    if (inlinebulk && code == 0) {
        if ((&statsp[0])->errorCode) {
            afs_Analyze(tcp, (&statsp[0])->errorCode, &adp->fid, areqp,
                        AFS_STATS_FS_RPCIDX_BULKSTATUS, SHARED_LOCK, NULL);