diff options
| author | Alan Somers <asomers@FreeBSD.org> | 2022-04-18 23:03:53 +0000 |
|---|---|---|
| committer | Alan Somers <asomers@FreeBSD.org> | 2022-04-19 00:59:10 +0000 |
| commit | 3a1b3c6a1e68063330e897a5a5c94518edae4a3b (patch) | |
| tree | d8998c93b28f460f03c2fec0da85c708f093f2fd /sys/fs | |
| parent | 8b83d7e0ee54416b0ee58bd85f9c0ae7fb3357a1 (diff) | |
Diffstat (limited to 'sys/fs')
| -rw-r--r-- | sys/fs/fuse/fuse_io.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index 07c0f958e028..9ef4badfcdff 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -395,8 +395,19 @@ retry: fwo = ((struct fuse_write_out *)fdi.answ); + if (fwo->size > fwi->size) { + fuse_warn(data, FSESS_WARN_WROTE_LONG, + "wrote more data than we provided it."); + /* This is bonkers. Clear attr cache. */ + fvdat->flag &= ~FN_SIZECHANGE; + fuse_vnode_clear_attr_cache(vp); + err = EINVAL; + break; + } + /* Adjust the uio in the case of short writes */ diff = fwi->size - fwo->size; + as_written_offset = uio->uio_offset - diff; if (as_written_offset - diff > filesize) { @@ -406,12 +417,7 @@ retry: if (as_written_offset - diff >= filesize) fvdat->flag &= ~FN_SIZECHANGE; - if (diff < 0) { - fuse_warn(data, FSESS_WARN_WROTE_LONG, - "wrote more data than we provided it."); - err = EINVAL; - break; - } else if (diff > 0) { + if (diff > 0) { /* Short write */ if (!direct_io) { fuse_warn(data, FSESS_WARN_SHORT_WRITE, |
