summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-10-24 00:14:36 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2014-10-24 00:14:36 +0200
commitcbdf35bcb833bfd00f0925d7a9a33a21f41ea582 (patch)
treefe76fb2eeaaf2b56d4961840caf97719567c6a88 /fs/namei.c
parentvfs: introduce clone_private_mount() (diff)
downloadlinux-cbdf35bcb833bfd00f0925d7a9a33a21f41ea582.tar.xz
linux-cbdf35bcb833bfd00f0925d7a9a33a21f41ea582.zip
vfs: export check_sticky()
It's already duplicated in btrfs and about to be used in overlayfs too. Move the sticky bit check to an inline helper and call the out-of-line helper only in the unlikly case of the sticky bit being set. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/namei.c b/fs/namei.c
index d944f6db9b07..77fd536106cb 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2384,22 +2384,17 @@ kern_path_mountpoint(int dfd, const char *name, struct path *path,
}
EXPORT_SYMBOL(kern_path_mountpoint);
-/*
- * It's inline, so penalty for filesystems that don't use sticky bit is
- * minimal.
- */
-static inline int check_sticky(struct inode *dir, struct inode *inode)
+int __check_sticky(struct inode *dir, struct inode *inode)
{
kuid_t fsuid = current_fsuid();
- if (!(dir->i_mode & S_ISVTX))
- return 0;
if (uid_eq(inode->i_uid, fsuid))
return 0;
if (uid_eq(dir->i_uid, fsuid))
return 0;
return !capable_wrt_inode_uidgid(inode, CAP_FOWNER);
}
+EXPORT_SYMBOL(__check_sticky);
/*
* Check whether we can remove a link victim from directory dir, check