mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vhost-user-fs: return EINVAL if req is out of range in fs_slave_mmap/unmap/sync
Return libc::EINVAL instead of custom "Wrong offset" error, as mmap(2) returns EINVAL when offset/len is invalid. Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
This commit is contained in:
parent
78b5cbc63a
commit
33be24bd5a
@ -71,7 +71,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.is_req_valid(offset, len) {
|
if !self.is_req_valid(offset, len) {
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "Wrong offset"));
|
return Err(io::Error::from_raw_os_error(libc::EINVAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
let addr = self.mmap_cache_addr + offset;
|
let addr = self.mmap_cache_addr + offset;
|
||||||
@ -117,7 +117,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.is_req_valid(offset, len) {
|
if !self.is_req_valid(offset, len) {
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "Wrong offset"));
|
return Err(io::Error::from_raw_os_error(libc::EINVAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
let addr = self.mmap_cache_addr + offset;
|
let addr = self.mmap_cache_addr + offset;
|
||||||
@ -152,7 +152,7 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.is_req_valid(offset, len) {
|
if !self.is_req_valid(offset, len) {
|
||||||
return Err(io::Error::new(io::ErrorKind::Other, "Wrong offset"));
|
return Err(io::Error::from_raw_os_error(libc::EINVAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
let addr = self.mmap_cache_addr + offset;
|
let addr = self.mmap_cache_addr + offset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user