Skip to contentSkip to conversation

io_uring/net: fix multishot accept overflow handling

PATCH New Jens Axboe 1 participant 1 message Feb 14, 2024 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/net: fix multishot accept overflow handling

If we hit CQ ring overflow when attempting to post a multishot accept completion, we don't properly the result stashing or return code. This results in losing the accepted fd value.

Handle this like we do for other multishot completions - assign the result, and return IOU_STOP_MULTISHOT to cancel any further completions from this request when overflow is hit. This preserves the result, as we should, and tells the application that the request needs to be re-armed.

Fixes 515e26961295 ("io_uring: revert "io_uring fix multishot accept ordering"")

---

io_uring/net.c +3 -2
index 43bc9a5f96f9..161622029147 100644
@@ -1372,7 +1372,7 @@ int io_accept(struct io_kiocb *req, unsigned int issue_flags)
 			 * has already been done
 			 */
 			if (issue_flags & IO_URING_F_MULTISHOT)
-				ret = IOU_ISSUE_SKIP_COMPLETE;
+				return IOU_ISSUE_SKIP_COMPLETE;
 			return ret;
 		}
 		if (ret == -ERESTARTSYS)
@@ -1397,7 +1397,8 @@ int io_accept(struct io_kiocb *req, unsigned int issue_flags)
 				ret, IORING_CQE_F_MORE))
 		goto retry;
 
-	return -ECANCELED;
+	io_req_set_res(req, ret, 0);
+	return IOU_STOP_MULTISHOT;
 }
 
 int io_socket_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
Signature · 1 line
Jens Axboe