File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ impl<F: FileSystem + Sync> Server<F> {
39
39
let in_header: InHeader = r. read_obj ( ) . map_err ( Error :: DecodeMessage ) ?;
40
40
let mut ctx = SrvContext :: < F , S > :: new ( in_header, r, w) ;
41
41
if ctx. in_header . len > ( MAX_BUFFER_SIZE + BUFFER_HEADER_SIZE ) {
42
+ if in_header. opcode == Opcode :: Forget as u32
43
+ || in_header. opcode == Opcode :: BatchForget as u32
44
+ {
45
+ // Forget and batch-forget do not require reply.
46
+ return Err ( Error :: InvalidMessage ( io:: Error :: from_raw_os_error (
47
+ libc:: EOVERFLOW ,
48
+ ) ) ) ;
49
+ }
42
50
return ctx. reply_error_explicit ( io:: Error :: from_raw_os_error ( libc:: ENOMEM ) ) ;
43
51
}
44
52
@@ -1007,10 +1015,14 @@ impl<F: FileSystem + Sync> Server<F> {
1007
1015
1008
1016
if let Some ( size) = ( count as usize ) . checked_mul ( size_of :: < ForgetOne > ( ) ) {
1009
1017
if size > MAX_BUFFER_SIZE as usize {
1010
- return ctx. reply_error_explicit ( io:: Error :: from_raw_os_error ( libc:: ENOMEM ) ) ;
1018
+ return Err ( Error :: InvalidMessage ( io:: Error :: from_raw_os_error (
1019
+ libc:: EOVERFLOW ,
1020
+ ) ) ) ;
1011
1021
}
1012
1022
} else {
1013
- return ctx. reply_error_explicit ( io:: Error :: from_raw_os_error ( libc:: EOVERFLOW ) ) ;
1023
+ return Err ( Error :: InvalidMessage ( io:: Error :: from_raw_os_error (
1024
+ libc:: EOVERFLOW ,
1025
+ ) ) ) ;
1014
1026
}
1015
1027
1016
1028
let mut requests = Vec :: with_capacity ( count as usize ) ;
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ pub enum Error {
74
74
/// The `size` field of the `SetxattrIn` message does not match the length
75
75
/// of the decoded value.
76
76
InvalidXattrSize ( ( u32 , usize ) ) ,
77
+ /// Invalid message that the server cannot handle properly.
78
+ InvalidMessage ( io:: Error ) ,
77
79
}
78
80
79
81
impl error:: Error for Error { }
@@ -92,6 +94,7 @@ impl fmt::Display for Error {
92
94
"The `size` field of the `SetxattrIn` message does not match the length of the \
93
95
decoded value: size = {size}, value.len() = {len}"
94
96
) ,
97
+ InvalidMessage ( err) => write ! ( f, "cannot process fuse message: {err}" ) ,
95
98
}
96
99
}
97
100
}
You can’t perform that action at this time.
0 commit comments