patch-1.3.7 linux/fs/umsdos/ioctl.c

Next file: linux/fs/umsdos/rdir.c
Previous file: linux/fs/umsdos/emd.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.6/linux/fs/umsdos/ioctl.c linux/fs/umsdos/ioctl.c
@@ -11,6 +11,7 @@
 
 #include <asm/segment.h>
 #include <linux/errno.h>
+#include <linux/mm.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -31,7 +32,7 @@
 */
 static int umsdos_ioctl_fill(
 	void * buf,
-	char * name,
+	const char * name,
 	int name_len,
 	off_t offset,
 	ino_t ino)
@@ -65,7 +66,13 @@
 		Only root (effective id) is allowed to do IOCTL on directory
 		in UMSDOS. EPERM is returned for other user.
 	*/
-	if (current->euid == 0
+	/*
+		Well, not all case require write access, but it simplify the code
+		and let's face it, there is only one client (umssync) for all this
+	*/
+	if (verify_area(VERIFY_WRITE,(void*)data,sizeof(struct umsdos_ioctl)) < 0){
+		ret = -EFAULT;
+	}else if (current->euid == 0
 		|| cmd == UMSDOS_GETVERSION){
 		struct umsdos_ioctl *idata = (struct umsdos_ioctl *)data;
 		ret = -EINVAL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this