mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	io_uring: limit registration w/ SINGLE_ISSUER
IORING_SETUP_SINGLE_ISSUER restricts what tasks can submit requests.
Extend it to registration as well, so non-owning task can't do
registrations. It's not necessary at the moment but might be useful in
the future.
Cc: <stable@vger.kernel.org> # 6.0
Fixes: 97bbdc06a4 ("io_uring: add IORING_SETUP_SINGLE_ISSUER")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/f52a6a9c8a8990d4a831f73c0571e7406aac2bba.1664237592.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
			
			
This commit is contained in:
		
							parent
							
								
									4add705e4e
								
							
						
					
					
						commit
						d7cce96c44
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		|  | @ -3890,6 +3890,9 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, | ||||||
| 	if (WARN_ON_ONCE(percpu_ref_is_dying(&ctx->refs))) | 	if (WARN_ON_ONCE(percpu_ref_is_dying(&ctx->refs))) | ||||||
| 		return -ENXIO; | 		return -ENXIO; | ||||||
| 
 | 
 | ||||||
|  | 	if (ctx->submitter_task && ctx->submitter_task != current) | ||||||
|  | 		return -EEXIST; | ||||||
|  | 
 | ||||||
| 	if (ctx->restricted) { | 	if (ctx->restricted) { | ||||||
| 		if (opcode >= IORING_REGISTER_LAST) | 		if (opcode >= IORING_REGISTER_LAST) | ||||||
| 			return -EINVAL; | 			return -EINVAL; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel Begunkov
						Pavel Begunkov