@@ -570,82 +570,6 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
570570 return ret ;
571571}
572572
573- void io_unregister_cqwait_reg (struct io_ring_ctx * ctx )
574- {
575- unsigned short npages = 1 ;
576-
577- if (!ctx -> cq_wait_page )
578- return ;
579-
580- io_pages_unmap (ctx -> cq_wait_arg , & ctx -> cq_wait_page , & npages , true);
581- ctx -> cq_wait_arg = NULL ;
582- if (ctx -> user )
583- __io_unaccount_mem (ctx -> user , 1 );
584- }
585-
586- /*
587- * Register a page holding N entries of struct io_uring_reg_wait, which can
588- * be used via io_uring_enter(2) if IORING_GETEVENTS_EXT_ARG_REG is set.
589- * If that is set with IORING_GETEVENTS_EXT_ARG, then instead of passing
590- * in a pointer for a struct io_uring_getevents_arg, an index into this
591- * registered array is passed, avoiding two (arg + timeout) copies per
592- * invocation.
593- */
594- static int io_register_cqwait_reg (struct io_ring_ctx * ctx , void __user * uarg )
595- {
596- struct io_uring_cqwait_reg_arg arg ;
597- struct io_uring_reg_wait * reg ;
598- struct page * * pages ;
599- unsigned long len ;
600- int nr_pages , poff ;
601- int ret ;
602-
603- if (ctx -> cq_wait_page || ctx -> cq_wait_arg )
604- return - EBUSY ;
605- if (copy_from_user (& arg , uarg , sizeof (arg )))
606- return - EFAULT ;
607- if (!arg .nr_entries || arg .flags )
608- return - EINVAL ;
609- if (arg .struct_size != sizeof (* reg ))
610- return - EINVAL ;
611- if (check_mul_overflow (arg .struct_size , arg .nr_entries , & len ))
612- return - EOVERFLOW ;
613- if (len > PAGE_SIZE )
614- return - EINVAL ;
615- /* offset + len must fit within a page, and must be reg_wait aligned */
616- poff = arg .user_addr & ~PAGE_MASK ;
617- if (len + poff > PAGE_SIZE )
618- return - EINVAL ;
619- if (poff % arg .struct_size )
620- return - EINVAL ;
621-
622- pages = io_pin_pages (arg .user_addr , len , & nr_pages );
623- if (IS_ERR (pages ))
624- return PTR_ERR (pages );
625- ret = - EINVAL ;
626- if (nr_pages != 1 )
627- goto out_free ;
628- if (ctx -> user ) {
629- ret = __io_account_mem (ctx -> user , 1 );
630- if (ret )
631- goto out_free ;
632- }
633-
634- reg = vmap (pages , 1 , VM_MAP , PAGE_KERNEL );
635- if (reg ) {
636- ctx -> cq_wait_index = arg .nr_entries - 1 ;
637- WRITE_ONCE (ctx -> cq_wait_page , pages );
638- WRITE_ONCE (ctx -> cq_wait_arg , (void * ) reg + poff );
639- return 0 ;
640- }
641- ret = - ENOMEM ;
642- if (ctx -> user )
643- __io_unaccount_mem (ctx -> user , 1 );
644- out_free :
645- io_pages_free (& pages , nr_pages );
646- return ret ;
647- }
648-
649573static int __io_uring_register (struct io_ring_ctx * ctx , unsigned opcode ,
650574 void __user * arg , unsigned nr_args )
651575 __releases (ctx - > uring_lock )
@@ -840,12 +764,6 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
840764 break ;
841765 ret = io_register_resize_rings (ctx , arg );
842766 break ;
843- case IORING_REGISTER_CQWAIT_REG :
844- ret = - EINVAL ;
845- if (!arg || nr_args != 1 )
846- break ;
847- ret = io_register_cqwait_reg (ctx , arg );
848- break ;
849767 default :
850768 ret = - EINVAL ;
851769 break ;
0 commit comments