From: Stefan Metzmacher Date: Fri, 8 May 2020 11:17:05 +0000 (+0200) Subject: vfs_io_uring: make use of sys_valid_io_range() in vfs_io_uring_pwrite_send() X-Git-Tag: ldb-2.2.0~529 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=388bc2e6e44470ea4043ecb22750e241145355d2;p=thirdparty%2Fsamba.git vfs_io_uring: make use of sys_valid_io_range() in vfs_io_uring_pwrite_send() This makes the follow up commits easier as we don't have to care about overflows. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14361 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_io_uring.c b/source3/modules/vfs_io_uring.c index c7565b8c39d..ee23449c63c 100644 --- a/source3/modules/vfs_io_uring.c +++ b/source3/modules/vfs_io_uring.c @@ -423,6 +423,7 @@ static struct tevent_req *vfs_io_uring_pwrite_send(struct vfs_handle_struct *han struct tevent_req *req = NULL; struct vfs_io_uring_pwrite_state *state = NULL; struct vfs_io_uring_config *config = NULL; + bool ok; SMB_VFS_HANDLE_GET_DATA(handle, config, struct vfs_io_uring_config, @@ -441,6 +442,12 @@ static struct tevent_req *vfs_io_uring_pwrite_send(struct vfs_handle_struct *han state->ur.profile_bytes, n); SMBPROFILE_BYTES_ASYNC_SET_IDLE(state->ur.profile_bytes); + ok = sys_valid_io_range(offset, n); + if (!ok) { + tevent_req_error(req, EINVAL); + return tevent_req_post(req, ev); + } + state->iov.iov_base = discard_const(data); state->iov.iov_len = n; io_uring_prep_writev(&state->ur.sqe,