Re: [PATCH] virtiofs: add FUSE protocol validation
From: Stefan Hajnoczi
Date: Tue Feb 17 2026 - 10:49:31 EST
On Mon, Feb 16, 2026 at 2:32 AM Yuto Ohnuki <ytohnuki@xxxxxxxxxx> wrote:
>
> Add virtio_fs_verify_response() to validate that the server properly
> follows the FUSE protocol by checking:
>
> - Response length is at least sizeof(struct fuse_out_header).
> - oh.len matches the actual response length.
> - oh.unique matches the request's unique identifier.
>
> On validation failure, set error to -EIO and normalize oh.len to prevent
> underflow in copy_args_from_argbuf().
>
> Addresses the TODO comment in virtio_fs_request_complete().
>
> Signed-off-by: Yuto Ohnuki <ytohnuki@xxxxxxxxxx>
> ---
> fs/fuse/virtio_fs.c | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>