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>
MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34955

Details