diff options
author | Brian Behlendorf <[email protected]> | 2010-07-01 13:37:43 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-07-01 13:53:26 -0700 |
commit | 7119bf704490bcb9abca9fa80214313024d381a2 (patch) | |
tree | 9a1a323ce6eb009b7c3a63c6fcfb794801e5fc8f /module | |
parent | e2d28a3743807c8708727cf51b94e4e8407bea65 (diff) |
Add configure check for user_path_dir()
I didn't notice at the time but user_path_dir() was not introduced
at the same time as set_fs_pwd() change. I had lumped the two
together but in fact user_path_dir() was introduced in 2.6.27 and
set_fs_pwd() taking 2 args was introduced in 2.6.25. This means
builds against 2.6.25-2.6.26 kernels were broken.
To fix this I've added a check for user_path_dir() and no longer
assume that if set_fs_pwd() takes 2 args then user_path_dir() is
also available.
Diffstat (limited to 'module')
-rw-r--r-- | module/spl/spl-vnode.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index ec312aad1..b5c34fbcd 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -648,7 +648,7 @@ set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, struct dentry *dentry) int vn_set_pwd(const char *filename) { -#ifdef HAVE_2ARGS_SET_FS_PWD +#if defined(HAVE_2ARGS_SET_FS_PWD) && defined(HAVE_USER_PATH_DIR) struct path path; #else struct nameidata nd; @@ -666,6 +666,7 @@ vn_set_pwd(const char *filename) set_fs(get_ds()); #ifdef HAVE_2ARGS_SET_FS_PWD +# ifdef HAVE_USER_PATH_DIR rc = user_path_dir(filename, &path); if (rc) GOTO(out, rc); @@ -678,6 +679,21 @@ vn_set_pwd(const char *filename) dput_and_out: path_put(&path); +# else + rc = __user_walk(filename, + LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); + if (rc) + GOTO(out, rc); + + rc = vfs_permission(&nd, MAY_EXEC); + if (rc) + GOTO(dput_and_out, rc); + + set_fs_pwd(current->fs, &nd.path); + +dput_and_out: + path_put(&nd.path); +# endif /* HAVE_USER_PATH_DIR */ #else rc = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); |