HomeFreeBSD

fusefs: correctly handle servers that report too much data written

Description

fusefs: correctly handle servers that report too much data written

During a FUSE_WRITE, the kernel requests the server to write a certain
amount of data, and the server responds with the amount that it actually
did write. It is obviously an error for the server to write more than
it was provided, and we always treated it as such, but there were two
problems:

  • If the server responded with a huge amount, greater than INT_MAX, it would trigger an integer overflow which would cause a panic.
  • When extending the file, we wrongly set the file's size before validing the amount written.

PR: 263263
Reported by: Robert Morris <rtm@lcs.mit.edu>
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34955

(cherry picked from commit 3a1b3c6a1e68063330e897a5a5c94518edae4a3b)

Details

Provenance
asomersAuthored on Apr 18 2022, 11:03 PM
Reviewer
emaste
Differential Revision
D34955: fusefs: correctly handle servers that report too much data written
Parents
rG73e02a370e52: fusefs: validate servers' error values
Branches
Unknown
Tags
Unknown