File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -155,30 +155,31 @@ static void io_netmsg_recycle(struct io_kiocb *req, unsigned int issue_flags)
155155 }
156156}
157157
158+ static void io_msg_async_data_init (void * obj )
159+ {
160+ struct io_async_msghdr * hdr = (struct io_async_msghdr * )obj ;
161+
162+ hdr -> free_iov = NULL ;
163+ hdr -> free_iov_nr = 0 ;
164+ }
165+
158166static struct io_async_msghdr * io_msg_alloc_async (struct io_kiocb * req )
159167{
160168 struct io_ring_ctx * ctx = req -> ctx ;
161169 struct io_async_msghdr * hdr ;
162170
163- hdr = io_alloc_cache_get (& ctx -> netmsg_cache );
164- if (hdr ) {
165- if (hdr -> free_iov ) {
166- kasan_mempool_unpoison_object (hdr -> free_iov ,
167- hdr -> free_iov_nr * sizeof (struct iovec ));
168- req -> flags |= REQ_F_NEED_CLEANUP ;
169- }
170- req -> flags |= REQ_F_ASYNC_DATA ;
171- req -> async_data = hdr ;
172- return hdr ;
173- }
171+ hdr = io_uring_alloc_async_data (& ctx -> netmsg_cache , req ,
172+ io_msg_async_data_init );
173+ if (!hdr )
174+ return NULL ;
174175
175- if (! io_alloc_async_data ( req )) {
176- hdr = req -> async_data ;
177- hdr -> free_iov_nr = 0 ;
178- hdr -> free_iov = NULL ;
179- return hdr ;
176+ /* If the async data was cached, we might have an iov cached inside. */
177+ if ( hdr -> free_iov ) {
178+ kasan_mempool_unpoison_object ( hdr -> free_iov ,
179+ hdr -> free_iov_nr * sizeof ( struct iovec )) ;
180+ req -> flags |= REQ_F_NEED_CLEANUP ;
180181 }
181- return NULL ;
182+ return hdr ;
182183}
183184
184185/* assign new iovec to kmsg, if we need to */
You can’t perform that action at this time.
0 commit comments