Unverified Commit ff58f8a1 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14467 io_uring/tctx: work around xa_store() allocation error issue

parents 0ab6c5bc 2c4dc5d7
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -8542,8 +8542,19 @@ static int io_uring_alloc_task_context(struct task_struct *task,
void __io_uring_free(struct task_struct *tsk)
{
	struct io_uring_task *tctx = tsk->io_uring;
	struct io_tctx_node *node;
	unsigned long index;

	WARN_ON_ONCE(!xa_empty(&tctx->xa));
	/*
	 * Fault injection forcing allocation errors in the xa_store() path
	 * can lead to xa_empty() returning false, even though no actual
	 * node is stored in the xarray. Until that gets sorted out, attempt
	 * an iteration here and warn if any entries are found.
	 */
	xa_for_each(&tctx->xa, index, node) {
		WARN_ON_ONCE(1);
		break;
	}
	WARN_ON_ONCE(tctx->io_wq);
	WARN_ON_ONCE(tctx->cached_refs);