diff options
author | Ivan Vecera <ivecera@redhat.com> | 2018-01-19 09:18:54 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-06-16 22:21:56 +0100 |
commit | 88a25f03d3d99c0eb6eedab5d1c142f4289d2059 (patch) | |
tree | 844dcf3b1ddc3c816002353a66e6d8099bd92347 | |
parent | 521f0550e647e6d73da5cb55315b40a25cf4c75f (diff) | |
download | linux-stable-88a25f03d3d99c0eb6eedab5d1c142f4289d2059.tar.gz linux-stable-88a25f03d3d99c0eb6eedab5d1c142f4289d2059.tar.bz2 linux-stable-88a25f03d3d99c0eb6eedab5d1c142f4289d2059.zip |
kernfs: fix regression in kernfs_fop_write caused by wrong type
commit ba87977a49913129962af8ac35b0e13e0fa4382d upstream.
Commit b7ce40cff0b9 ("kernfs: cache atomic_write_len in
kernfs_open_file") changes type of local variable 'len' from ssize_t
to size_t. This change caused that the *ppos value is updated also
when the previous write callback failed.
Mentioned snippet:
...
len = ops->write(...); <- return value can be negative
...
if (len > 0) <- true here in this case
*ppos += len;
...
Fixes: b7ce40cff0b9 ("kernfs: cache atomic_write_len in kernfs_open_file")
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | fs/kernfs/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index b120e85aa7b9..2f442d9f0cf9 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -267,7 +267,7 @@ static ssize_t kernfs_fop_write(struct file *file, const char __user *user_buf, { struct kernfs_open_file *of = kernfs_of(file); const struct kernfs_ops *ops; - size_t len; + ssize_t len; char *buf; if (of->atomic_write_len) { |