diff --git a/fs/internal.h b/fs/internal.h index 0eda35fa1743..53846bd4d9d7 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -55,6 +55,7 @@ extern void __init chrdev_init(void); extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *); extern int vfs_path_lookup(struct dentry *, struct vfsmount *, const char *, unsigned int, struct path *); +long do_mkdirat(int dfd, const char __user *pathname, umode_t mode); long do_rmdir(int dfd, const char __user *pathname); long do_unlinkat(int dfd, struct filename *name); diff --git a/fs/namei.c b/fs/namei.c index 8545151f74e9..dcf506227509 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3803,7 +3803,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) } EXPORT_SYMBOL(vfs_mkdir); -SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) +long do_mkdirat(int dfd, const char __user *pathname, umode_t mode) { struct dentry *dentry; struct path path; @@ -3828,9 +3828,14 @@ retry: return error; } +SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) +{ + return do_mkdirat(dfd, pathname, mode); +} + SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode) { - return sys_mkdirat(AT_FDCWD, pathname, mode); + return do_mkdirat(AT_FDCWD, pathname, mode); } int vfs_rmdir(struct inode *dir, struct dentry *dentry) diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 746043a05884..c982cb5f4e50 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -972,4 +972,11 @@ static inline long ksys_rmdir(const char __user *pathname) return do_rmdir(AT_FDCWD, pathname); } +extern long do_mkdirat(int dfd, const char __user *pathname, umode_t mode); + +static inline long ksys_mkdir(const char __user *pathname, umode_t mode) +{ + return do_mkdirat(AT_FDCWD, pathname, mode); +} + #endif diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index e9e9e1c67d31..99922d1ebfe6 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -60,7 +60,7 @@ static void __init handle_initrd(void) create_dev("/dev/root.old", Root_RAM0); /* mount initrd on rootfs' /root */ mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); - sys_mkdir("/old", 0700); + ksys_mkdir("/old", 0700); ksys_chdir("/old"); /* try loading default modules from initrd */ diff --git a/init/initramfs.c b/init/initramfs.c index 73bbb227f868..ca538a5f9fa9 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -352,7 +352,7 @@ static int __init do_name(void) } } } else if (S_ISDIR(mode)) { - sys_mkdir(collected, mode); + ksys_mkdir(collected, mode); sys_chown(collected, uid, gid); sys_chmod(collected, mode); dir_add(collected, mtime); diff --git a/init/noinitramfs.c b/init/noinitramfs.c index 267739d85179..a08a9d937e60 100644 --- a/init/noinitramfs.c +++ b/init/noinitramfs.c @@ -29,7 +29,7 @@ static int __init default_rootfs(void) { int err; - err = sys_mkdir((const char __user __force *) "/dev", 0755); + err = ksys_mkdir((const char __user __force *) "/dev", 0755); if (err < 0) goto out; @@ -39,7 +39,7 @@ static int __init default_rootfs(void) if (err < 0) goto out; - err = sys_mkdir((const char __user __force *) "/root", 0700); + err = ksys_mkdir((const char __user __force *) "/root", 0700); if (err < 0) goto out;