mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	io_uring/net: unify *mshot_prep calls with compat
Instead of duplicating a io_recvmsg_mshot_prep() call in the compat path, let the common code handle it. For that, copy necessary compat fields into struct user_msghdr. Note, it zeroes user_msghdr to be on the safe side as compat is not that interesting and overhead shouldn't be high. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/94e62386dec570f83b4a4270a46ac60bc415fb71.1740569495.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
							parent
							
								
									0c623f4899
								
							
						
					
					
						commit
						51e158d405
					
				
					 1 changed files with 7 additions and 7 deletions
				
			
		|  | @ -714,20 +714,20 @@ static int io_recvmsg_copy_hdr(struct io_kiocb *req, | |||
| 	iomsg->msg.msg_name = &iomsg->addr; | ||||
| 	iomsg->msg.msg_iter.nr_segs = 0; | ||||
| 
 | ||||
| #ifdef CONFIG_COMPAT | ||||
| 	if (io_is_compat(req->ctx)) { | ||||
| #ifdef CONFIG_COMPAT | ||||
| 		struct compat_msghdr cmsg; | ||||
| 
 | ||||
| 		ret = io_compat_msg_copy_hdr(req, iomsg, &cmsg, ITER_DEST, | ||||
| 					     &iomsg->uaddr); | ||||
| 		if (unlikely(ret)) | ||||
| 			return ret; | ||||
| 		return io_recvmsg_mshot_prep(req, iomsg, cmsg.msg_namelen, | ||||
| 						cmsg.msg_controllen); | ||||
| 	} | ||||
| 		memset(&msg, 0, sizeof(msg)); | ||||
| 		msg.msg_namelen = cmsg.msg_namelen; | ||||
| 		msg.msg_controllen = cmsg.msg_controllen; | ||||
| #endif | ||||
| 	} else { | ||||
| 		ret = io_msg_copy_hdr(req, iomsg, &msg, ITER_DEST, &iomsg->uaddr); | ||||
| 	} | ||||
| 
 | ||||
| 	ret = io_msg_copy_hdr(req, iomsg, &msg, ITER_DEST, &iomsg->uaddr); | ||||
| 	if (unlikely(ret)) | ||||
| 		return ret; | ||||
| 	return io_recvmsg_mshot_prep(req, iomsg, msg.msg_namelen, | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Pavel Begunkov
						Pavel Begunkov