patch-2.1.120 linux/fs/read_write.c

Next file: linux/fs/ufs/acl.c
Previous file: linux/fs/qnx4/truncate.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.119/linux/fs/read_write.c linux/fs/read_write.c
@@ -288,7 +288,7 @@
 	file = fget(fd);
 	if (!file)
 		goto bad_file;
-	if (file->f_mode & FMODE_READ)
+	if (file->f_op && file->f_op->read && (file->f_mode & FMODE_READ))
 		ret = do_readv_writev(VERIFY_WRITE, file, vector, count);
 	fput(file);
 
@@ -309,7 +309,7 @@
 	file = fget(fd);
 	if (!file)
 		goto bad_file;
-	if (file->f_mode & FMODE_WRITE) {
+	if (file->f_op && file->f_op->write && (file->f_mode & FMODE_WRITE)) {
 		down(&file->f_dentry->d_inode->i_sem);
 		ret = do_readv_writev(VERIFY_READ, file, vector, count);
 		up(&file->f_dentry->d_inode->i_sem);

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