@@ -385,16 +385,11 @@ static int io_send_setup(struct io_kiocb *req)
385
385
return 0 ;
386
386
}
387
387
388
- static int io_sendmsg_prep_setup (struct io_kiocb * req , int is_msg )
388
+ static int io_sendmsg_setup (struct io_kiocb * req )
389
389
{
390
- struct io_async_msghdr * kmsg ;
390
+ struct io_async_msghdr * kmsg = req -> async_data ;
391
391
int ret ;
392
392
393
- kmsg = io_msg_alloc_async (req );
394
- if (unlikely (!kmsg ))
395
- return - ENOMEM ;
396
- if (!is_msg )
397
- return io_send_setup (req );
398
393
ret = io_sendmsg_copy_hdr (req , kmsg );
399
394
if (!ret )
400
395
req -> flags |= REQ_F_NEED_CLEANUP ;
@@ -440,7 +435,11 @@ int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
440
435
if (req -> ctx -> compat )
441
436
sr -> msg_flags |= MSG_CMSG_COMPAT ;
442
437
#endif
443
- return io_sendmsg_prep_setup (req , req -> opcode == IORING_OP_SENDMSG );
438
+ if (unlikely (!io_msg_alloc_async (req )))
439
+ return - ENOMEM ;
440
+ if (req -> opcode != IORING_OP_SENDMSG )
441
+ return io_send_setup (req );
442
+ return io_sendmsg_setup (req );
444
443
}
445
444
446
445
static void io_req_msg_cleanup (struct io_kiocb * req ,
@@ -1278,7 +1277,11 @@ int io_send_zc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1278
1277
if (req -> ctx -> compat )
1279
1278
zc -> msg_flags |= MSG_CMSG_COMPAT ;
1280
1279
#endif
1281
- return io_sendmsg_prep_setup (req , req -> opcode == IORING_OP_SENDMSG_ZC );
1280
+ if (unlikely (!io_msg_alloc_async (req )))
1281
+ return - ENOMEM ;
1282
+ if (req -> opcode != IORING_OP_SENDMSG_ZC )
1283
+ return io_send_setup (req );
1284
+ return io_sendmsg_setup (req );
1282
1285
}
1283
1286
1284
1287
static int io_sg_from_iter_iovec (struct sk_buff * skb ,
0 commit comments