Re: [PATCH driver-core] kernfs: fix regression in kernfs_fop_write caused by wrong type

From: Al Viro
Date: Fri Jan 19 2018 - 12:18:44 EST


On Fri, Jan 19, 2018 at 09:16:36AM -0800, Tejun Heo wrote:
> On Fri, Jan 19, 2018 at 09:18:54AM +0100, Ivan Vecera wrote:
> > 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")
> > Signed-off-by: Ivan Vecera <ivecera@xxxxxxxxxx>
>
> Oops.
>
> Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Applied.