lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-5-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Mon, 21 Dec 2015 23:46:38 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	linux-kernel@...r.kernel.org
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 05/83] switch copy_mount_options to storing void * instead of unsigned long

From: Al Viro <viro@...iv.linux.org.uk>

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 fs/compat.c    | 11 +++++------
 fs/internal.h  |  2 +-
 fs/namespace.c | 21 ++++++++++-----------
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index c4708ae..254af5d 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -792,7 +792,7 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
 		       const void __user *, data)
 {
 	char *kernel_type;
-	unsigned long data_page;
+	void *data_page;
 	char *kernel_dev;
 	int retval;
 
@@ -814,18 +814,17 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
 
 	if (kernel_type && data_page) {
 		if (!strcmp(kernel_type, NCPFS_NAME)) {
-			do_ncp_super_data_conv((void *)data_page);
+			do_ncp_super_data_conv(data_page);
 		} else if (!strcmp(kernel_type, NFS4_NAME)) {
-			if (do_nfs4_super_data_conv((void *) data_page))
+			if (do_nfs4_super_data_conv(data_page))
 				goto out3;
 		}
 	}
 
-	retval = do_mount(kernel_dev, dir_name, kernel_type,
-			flags, (void*)data_page);
+	retval = do_mount(kernel_dev, dir_name, kernel_type, flags, data_page);
 
  out3:
-	free_page((void *)data_page);
+	free_page(data_page);
  out2:
 	kfree(kernel_dev);
  out1:
diff --git a/fs/internal.h b/fs/internal.h
index 71859c4d..8e64f77 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -55,7 +55,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
 /*
  * namespace.c
  */
-extern int copy_mount_options(const void __user *, unsigned long *);
+extern int copy_mount_options(const void __user *, void **);
 extern char *copy_mount_string(const void __user *);
 
 extern struct vfsmount *lookup_mnt(struct path *);
diff --git a/fs/namespace.c b/fs/namespace.c
index 55df421..4bcae39 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2601,17 +2601,17 @@ static long exact_copy_from_user(void *to, const void __user * from,
 	return n;
 }
 
-int copy_mount_options(const void __user * data, unsigned long *where)
+int copy_mount_options(const void __user * data, void **where)
 {
 	int i;
-	unsigned long page;
+	char *page;
 	unsigned long size;
 
-	*where = 0;
+	*where = NULL;
 	if (!data)
 		return 0;
 
-	if (!(page = __get_free_page(GFP_KERNEL)))
+	if (!(page = (char *)__get_free_page(GFP_KERNEL)))
 		return -ENOMEM;
 
 	/* We only care that *some* data at the address the user
@@ -2623,13 +2623,13 @@ int copy_mount_options(const void __user * data, unsigned long *where)
 	if (size > PAGE_SIZE)
 		size = PAGE_SIZE;
 
-	i = size - exact_copy_from_user((void *)page, data, size);
+	i = size - exact_copy_from_user(page, data, size);
 	if (!i) {
-		free_page((void *)page);
+		free_page(page);
 		return -EFAULT;
 	}
 	if (i != PAGE_SIZE)
-		memset((char *)page + i, 0, PAGE_SIZE - i);
+		memset(page + i, 0, PAGE_SIZE - i);
 	*where = page;
 	return 0;
 }
@@ -2896,7 +2896,7 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
 	int ret;
 	char *kernel_type;
 	char *kernel_dev;
-	unsigned long data_page;
+	void *data_page;
 
 	kernel_type = copy_mount_string(type);
 	ret = PTR_ERR(kernel_type);
@@ -2912,10 +2912,9 @@ SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
 	if (ret < 0)
 		goto out_data;
 
-	ret = do_mount(kernel_dev, dir_name, kernel_type, flags,
-		(void *) data_page);
+	ret = do_mount(kernel_dev, dir_name, kernel_type, flags, data_page);
 
-	free_page((void *)data_page);
+	free_page(data_page);
 out_data:
 	kfree(kernel_dev);
 out_dev:
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ