Skip to content

Commit 880fe76

Browse files
RoelKluintorvalds
authored andcommitted
hppfs: hppfs_read_file() may return -ERROR
hppfs_read_file() may return (ssize_t) -ENOMEM, or -EFAULT. When stored in size_t 'count', these errors will not be noticed, a large value will be added to *ppos. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 695f6ae commit 880fe76

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎fs/hppfs/hppfs.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
280280
"errno = %d\n", err);
281281
return err;
282282
}
283-
count = hppfs_read_file(hppfs->host_fd, buf, count);
283+
err = hppfs_read_file(hppfs->host_fd, buf, count);
284+
if (err < 0) {
285+
printk(KERN_ERR "hppfs_read: read failed: %d\n", err);
286+
return err;
287+
}
288+
count = err;
284289
if (count > 0)
285290
*ppos += count;
286291
}

0 commit comments

Comments
 (0)