fuse: verify attributes
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 12 Nov 2019 10:49:04 +0000 (11:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 09:41:30 +0000 (10:41 +0100)
commitc392b3a69ceddde55dea62a4bb83d542e60dfdbc
tree3a3b1c640684eb6c87991c5adae06b29a7af2d6f
parent38969fe9b9137ec0141b9a1d66edf42d1c4da1c5
fuse: verify attributes

commit eb59bd17d2fa6e5e84fba61a5ebdea984222e6d5 upstream.

If a filesystem returns negative inode sizes, future reads on the file were
causing the cpu to spin on truncate_pagecache.

Create a helper to validate the attributes.  This now does two things:

 - check the file mode
 - check if the file size fits in i_size without overflowing

Reported-by: Arijit Banerjee <arijit@rubrik.com>
Fixes: d8a5ba45457e ("[PATCH] FUSE - core")
Cc: <stable@vger.kernel.org> # v2.6.14
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/fuse/dir.c
fs/fuse/fuse_i.h