Skip to content

Commit f604180

Browse files
committed
io_uring/net: ensure vectored buffer node import is tied to notification
When support for vectored registered buffers was added, the import itself is using 'req' rather than the notification io_kiocb, sr->notif. For non-vectored imports, sr->notif is correctly used. This is important as the lifetime of the two may be different. Use the correct io_kiocb for the vectored buffer import. Cc: stable@vger.kernel.org Fixes: 23371ea ("io_uring/net: implement vectored reg bufs for zctx") Reported-by: Google Big Sleep <big-sleep-vuln-reports+bigsleep-463332873@google.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 4644736 commit f604180

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

io_uring/net.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,8 +1532,10 @@ int io_sendmsg_zc(struct io_kiocb *req, unsigned int issue_flags)
15321532
unsigned uvec_segs = kmsg->msg.msg_iter.nr_segs;
15331533
int ret;
15341534

1535-
ret = io_import_reg_vec(ITER_SOURCE, &kmsg->msg.msg_iter, req,
1536-
&kmsg->vec, uvec_segs, issue_flags);
1535+
sr->notif->buf_index = req->buf_index;
1536+
ret = io_import_reg_vec(ITER_SOURCE, &kmsg->msg.msg_iter,
1537+
sr->notif, &kmsg->vec, uvec_segs,
1538+
issue_flags);
15371539
if (unlikely(ret))
15381540
return ret;
15391541
req->flags &= ~REQ_F_IMPORT_BUFFER;

0 commit comments

Comments
 (0)