patch-2.1.61 linux/fs/smbfs/ioctl.c

Next file: linux/fs/smbfs/proc.c
Previous file: linux/fs/smbfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.60/linux/fs/smbfs/ioctl.c linux/fs/smbfs/ioctl.c
@@ -8,10 +8,11 @@
 
 #include <linux/errno.h>
 #include <linux/fs.h>
-#include <linux/smb_fs.h>
 #include <linux/ioctl.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/smb_fs.h>
+#include <linux/smb_mount.h>
 
 #include <asm/uaccess.h>
 
@@ -19,33 +20,33 @@
 smb_ioctl(struct inode *inode, struct file *filp,
 	  unsigned int cmd, unsigned long arg)
 {
+	int result = -EINVAL;
+
 	switch (cmd)
 	{
 	case SMB_IOC_GETMOUNTUID:
-		return put_user(SMB_SERVER(inode)->m.mounted_uid,
+		result = put_user(SMB_SERVER(inode)->mnt->mounted_uid,
 				(uid_t *) arg);
+		break;
 
 	case SMB_IOC_NEWCONN:
 	{
 		struct smb_conn_opt opt;
-		int result;
 
 		if (arg == 0)
 		{
 			/* The process offers a new connection upon SIGUSR1 */
-			return smb_offerconn(SMB_SERVER(inode));
+			result = smb_offerconn(SMB_SERVER(inode));
 		}
-
-		if ((result = verify_area(VERIFY_READ, (uid_t *) arg,
-					  sizeof(opt))) != 0)
+		else
 		{
-			return result;
+			result = -EFAULT;
+			if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
+				result = smb_newconn(SMB_SERVER(inode), &opt);
 		}
-		copy_from_user(&opt, (void *)arg, sizeof(opt));
-
-		return smb_newconn(SMB_SERVER(inode), &opt);
+		break;
 	}
 	default:
-		return -EINVAL;
 	}
+	return result;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov