patch-2.1.2 linux/fs/pipe.c

Next file: linux/fs/read_write.c
Previous file: linux/fs/open.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.1/linux/fs/pipe.c linux/fs/pipe.c
@@ -51,6 +51,10 @@
 		interruptible_sleep_on(&PIPE_WAIT(*inode));
 	}
 	PIPE_LOCK(*inode)++;
+	if (exception()) {
+		PIPE_LOCK(*inode)--;
+		return -EFAULT;
+	}
 	while (count>0 && (size = PIPE_SIZE(*inode))) {
 		chars = PIPE_MAX_RCHUNK(*inode);
 		if (chars > count)
@@ -66,6 +70,7 @@
 		memcpy_tofs(buf, pipebuf, chars );
 		buf += chars;
 	}
+	end_exception();
 	PIPE_LOCK(*inode)--;
 	wake_up_interruptible(&PIPE_WAIT(*inode));
 	if (read) {
@@ -105,6 +110,10 @@
 			interruptible_sleep_on(&PIPE_WAIT(*inode));
 		}
 		PIPE_LOCK(*inode)++;
+		if (exception()) {
+			PIPE_LOCK(*inode)--;
+			return -EFAULT;
+		}
 		while (count>0 && (free = PIPE_FREE(*inode))) {
 			chars = PIPE_MAX_WCHUNK(*inode);
 			if (chars > count)
@@ -118,6 +127,7 @@
 			memcpy_fromfs(pipebuf, buf, chars );
 			buf += chars;
 		}
+		end_exception();
 		PIPE_LOCK(*inode)--;
 		wake_up_interruptible(&PIPE_WAIT(*inode));
 		free = 1;

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