VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Al Viro <viro@zeniv.linux.org.uk> 2013-10-08 09:11:48 -0400 committer: Al Viro <viro@zeniv.linux.org.uk> 2013-11-09 00:16:26 -0500 commit: 2507a4fbd48a96bc4236e584252635f8539079df parent: 1ad67015e619ba4e0b15ed0482d464292fedf263
Commit Summary:
make dump_emit() use vfs_write() instead of banging at ->f_op->write directly
Diffstat:
1 file changed, 12 insertions, 5 deletions
diff --git a/fs/coredump.c b/fs/coredump.c
index 319f973bab72..2472ed9e682c 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -696,13 +696,20 @@ EXPORT_SYMBOL(dump_write);
 int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
 {
 	struct file *file = cprm->file;
-	if (dump_interrupted() || !access_ok(VERIFY_READ, addr, nr))
-		return 0;
+	loff_t pos = file->f_pos;
+	ssize_t n;
 	if (cprm->written + nr > cprm->limit)
 		return 0;
-	if (file->f_op->write(file, addr, nr, &file->f_pos) != nr)
-		return 0;
-	cprm->written += nr;
+	while (nr) {
+		if (dump_interrupted())
+			return 0;
+		n = vfs_write(file, addr, nr, &pos);
+		if (n <= 0)
+			return 0;
+		file->f_pos = pos;
+		cprm->written += n;
+		nr -= n;
+	}
 	return 1;
 }
 EXPORT_SYMBOL(dump_emit);