Skip to content

Commit 1a089de

Browse files
authored
Bug: iovec array not stable during sendmsg_zc op (#257)
The iovec array must be stable until either: - Operation completion, or - not doing IORING_SETUP_SQPOLL, and feature IORING_FEAT_SUBMIT_STABLE is present This fix takes the simple option of holding the iovec until operation is completed.
1 parent f562364 commit 1a089de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/io/sendmsg_zc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ pub(crate) struct SendMsgZc<T, U> {
1313
#[allow(dead_code)]
1414
io_bufs: Vec<T>,
1515
#[allow(dead_code)]
16+
io_slices: Vec<IoSlice<'static>>,
17+
#[allow(dead_code)]
1618
socket_addr: Option<Box<SockAddr>>,
1719
msg_control: Option<U>,
1820
msghdr: libc::msghdr,
@@ -32,7 +34,7 @@ impl<T: BoundedBuf, U: BoundedBuf> Op<SendMsgZc<T, U>, MultiCQEFuture> {
3234

3335
let mut msghdr: libc::msghdr = unsafe { std::mem::zeroed() };
3436

35-
let mut io_slices: Vec<IoSlice> = Vec::with_capacity(io_bufs.len());
37+
let mut io_slices: Vec<IoSlice<'static>> = Vec::with_capacity(io_bufs.len());
3638

3739
for io_buf in &io_bufs {
3840
io_slices.push(IoSlice::new(unsafe {
@@ -74,6 +76,7 @@ impl<T: BoundedBuf, U: BoundedBuf> Op<SendMsgZc<T, U>, MultiCQEFuture> {
7476
fd: fd.clone(),
7577
io_bufs,
7678
socket_addr,
79+
io_slices,
7780
msg_control,
7881
msghdr,
7982
bytes: 0,

0 commit comments

Comments
 (0)