@@ -760,7 +760,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
struct file *file = cprm->file;
loff_t pos = file->f_pos;
ssize_t n;
- if (pos + nr > cprm->limit)
+ if (cprm->written + nr > cprm->limit)
return 0;
while (nr) {
if (dump_interrupted())
@@ -769,6 +769,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr)
if (n <= 0)
return 0;
file->f_pos = pos;
+ cprm->written += nr;
nr -= n;
}
return 1;
@@ -780,8 +781,6 @@ int dump_skip(struct coredump_params *cprm, size_t nr)
static char zeroes[PAGE_SIZE];
struct file *file = cprm->file;
if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
- if (file->f_pos + nr > cprm->limit)
- return 0;
if (dump_interrupted() ||
file->f_op->llseek(file, nr, SEEK_CUR) < 0)
return 0;
@@ -64,6 +64,7 @@ struct coredump_params {
struct file *file;
unsigned long limit;
unsigned long mm_flags;
+ loff_t written;
};
/*