]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX: Use afs_convert_code in afs_notify_change
authorAndrew Deason <adeason@sinenomine.net>
Wed, 22 Feb 2012 21:40:20 +0000 (15:40 -0600)
committerDerrick Brashear <shadow@dementix.org>
Wed, 21 Mar 2012 04:00:07 +0000 (21:00 -0700)
afs_notify_change currently just returns "-code". This can cause a
panic if the error code is negative, since we will return a positive
error code, which may get interpreted as a valid pointer value in
higher levels.

Specifically, if we hit afs_notify_change via something like this code
path:

do_sys_open -> do_filp_open -> open_namei -> may_open -> do_truncate
-> notify_change -> afs_notify_change (via inode->i_op->setattr)

the positive error value will be interpreted by do_sys_open as a valid
'struct file' pointer, and will be dereferenced.

So pass the return value through afs_convert_code, like all of the
other vnode ops, so we ensure we return an error properly.

Reviewed-on: http://gerrit.openafs.org/6776
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 634c6f184b17e30ade86c0a838ab55ddddc730d6)

Change-Id: I5083f6ce4bea5b3bea551e5d47155453b7ff2328
Reviewed-on: http://gerrit.openafs.org/6918
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/LINUX/osi_vnodeops.c
src/afs/LINUX24/osi_vnodeops.c

index 93ea124c016587f64f2cc20119e278ed61d84788..e8fc96a9b4b6f4c9bf5bd610224c38a20f7d06b0 100644 (file)
@@ -885,7 +885,7 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp)
     }
     AFS_GUNLOCK();
     crfree(credp);
-    return -code;
+    return afs_convert_code(code);
 }
 
 static int
index b4c938d0657889a98d927e96fc6f6f4d1e5ca08f..841f453a5201562f31ef66dbd054a834937b979c 100644 (file)
@@ -962,7 +962,7 @@ afs_notify_change(struct dentry *dp, struct iattr *iattrp)
     }
     AFS_GUNLOCK();
     crfree(credp);
-    return -code;
+    return afs_convert_code(code);
 }
 
 /* Validate a dentry. Return 1 if unchanged, 0 if VFS layer should re-evaluate.