aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-10-10 15:25:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-12 20:14:55 -0400
commit91a27b2a756784714e924e5e854b919273082d26 (patch)
tree3913246b7d6e62703ec915f481e3a7159393f0f0 /fs/compat.c
parent8e377d15078a501c4da98471f56396343c407d92 (diff)
vfs: define struct filename and have getname() return it
getname() is intended to copy pathname strings from userspace into a kernel buffer. The result is just a string in kernel space. It would however be quite helpful to be able to attach some ancillary info to the string. For instance, we could attach some audit-related info to reduce the amount of audit-related processing needed. When auditing is enabled, we could also call getname() on the string more than once and not need to recopy it from userspace. This patchset converts the getname()/putname() interfaces to return a struct instead of a string. For now, the struct just tracks the string in kernel space and the original userland pointer for it. Later, we'll add other information to the struct as it becomes convenient. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/compat.c b/fs/compat.c
index b7a24d0ca30d..015e1e1f87c6 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -776,16 +776,16 @@ asmlinkage long compat_sys_mount(const char __user * dev_name,
776 char *kernel_type; 776 char *kernel_type;
777 unsigned long data_page; 777 unsigned long data_page;
778 char *kernel_dev; 778 char *kernel_dev;
779 char *dir_page; 779 struct filename *dir;
780 int retval; 780 int retval;
781 781
782 retval = copy_mount_string(type, &kernel_type); 782 retval = copy_mount_string(type, &kernel_type);
783 if (retval < 0) 783 if (retval < 0)
784 goto out; 784 goto out;
785 785
786 dir_page = getname(dir_name); 786 dir = getname(dir_name);
787 retval = PTR_ERR(dir_page); 787 retval = PTR_ERR(dir);
788 if (IS_ERR(dir_page)) 788 if (IS_ERR(dir))
789 goto out1; 789 goto out1;
790 790
791 retval = copy_mount_string(dev_name, &kernel_dev); 791 retval = copy_mount_string(dev_name, &kernel_dev);
@@ -807,7 +807,7 @@ asmlinkage long compat_sys_mount(const char __user * dev_name,
807 } 807 }
808 } 808 }
809 809
810 retval = do_mount(kernel_dev, dir_page, kernel_type, 810 retval = do_mount(kernel_dev, dir->name, kernel_type,
811 flags, (void*)data_page); 811 flags, (void*)data_page);
812 812
813 out4: 813 out4:
@@ -815,7 +815,7 @@ asmlinkage long compat_sys_mount(const char __user * dev_name,
815 out3: 815 out3:
816 kfree(kernel_dev); 816 kfree(kernel_dev);
817 out2: 817 out2:
818 putname(dir_page); 818 putname(dir);
819 out1: 819 out1:
820 kfree(kernel_type); 820 kfree(kernel_type);
821 out: 821 out: