patch-1.3.99 linux/fs/fat/dir.c

Next file: linux/fs/fat/msbuffer.h
Previous file: linux/fs/ext/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.98/linux/fs/fat/dir.c linux/fs/fat/dir.c
@@ -380,6 +380,7 @@
 int fat_dir_ioctl(struct inode * inode, struct file * filp,
 		  unsigned int cmd, unsigned long arg)
 {
+	int err;
 	/*
 	 * We want to provide an interface for Samba to be able
 	 * to get the short filename for a given long filename.
@@ -389,6 +390,9 @@
 	switch (cmd) {
 	case VFAT_IOCTL_READDIR_BOTH: {
 		struct dirent *d1 = (struct dirent *)arg;
+		err = verify_area(VERIFY_WRITE, d1, sizeof (*d1));
+		if (err)
+			return err;
 		put_user(0, &d1->d_reclen);
 		return fat_readdirx(inode,filp,(void *)arg,
 				    vfat_ioctl_fill, NULL, 0, 1, 1);
@@ -396,6 +400,9 @@
 	case VFAT_IOCTL_READDIR_SHORT: {
 		struct dirent *d1 = (struct dirent *)arg;
 		put_user(0, &d1->d_reclen);
+		err = verify_area(VERIFY_WRITE, d1, sizeof (*d1));
+		if (err)
+			return err;
 		return fat_readdirx(inode,filp,(void *)arg,
 				    vfat_ioctl_fill, NULL, 1, 0, 1);
 	}

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