From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379527; b=GVV6VQY8HB8/g1gJYVMeEoD4cMwaXvjxb43MPdGpWQoy5U9StjN13iotDZjBsDwWikqW PcKEqGAc+3AA5cz+OL9jlyU0Af7JhDyDglp92htjehWt1tI1ZOLuUhNegDraqWWowuH0r pbWEwxn6UGLbVPIBFcCnlW4nu3fLeLl8pcW0QAX7smxQsSOFbWjDk4OVD4NKR2XyvUYWZ Tg6Iy389tqTE+KM6LLC/qzyjzuVCIvgLCjKiZqlBdV55DpJEpNFrKdgoSKynAD9HvSFOY Z5ZSg5Xfu9xEC/4KdAt4ICDUTtmhaQ/t5w9+FdJsR5q8SGC/sUald6v8UIYGxRUDWCQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379527; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=bt0LfvYSFIrM4YYoy8OIaxJvqso/h+KVujh4EzCgU2g=; b=mPP5JWmya8stOcIyBufnfK2YawoBcjKAO1+dXJaClDyJ9UAcPUKGK7cUrBC9Jb+slVJq 3sTLbCvExtZYmzG2vznNigNDMl6K3NZUwH36TcYs0whDDJXD66TY1pkkyomHObMuWUIsD bDFaBBXV6CykZdiihax2Ju5Cx8Xp1OAWiM3KGQC/GWdAKriaIXZgDfQlONW6gvZQ4wcuW B9N2yP6gAUpi4vR/5bgqr9rvIAQxyn2yG2ngwRW/xioyG9hvFvINTNrLjY+RXlMxpkfuT DqQSo/T06UbeGJn2PzBGNHj/H1JY9YEDOjPmgAl1WTuIscnXraLBsQtZ4Vo2AUjX6AQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Hf8SRqIc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0841C606A322; Fri, 4 Dec 2026 10:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Hf8SRqIc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7351E1F000CE; Fri, 4 Dec 2026 10:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379526; bh=bt0LfvYSFIrM4YYoy8OIaxJvqso/h+KVujh4EzCgU2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Hf8SRqIcYaIxWyVwIO3/74QYGtdhraGRvTkk/ksPyv+lzzmGQCrxZvzJV82kBnrBG c81jD23PuBPiT1zTBP5SuDyGJdCr9IE0/+nG0gCoKZA/VBptJjxraSNBcP8Hr91bBy kbsFMTtLbaFoqMFh1Dlu2qNXR8HwUQYxsWdDETl4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bui Quang Minh , lizetao , Pavel Begunkov , Jens Axboe , Sasha Levin Subject: [PATCH 6.6 0030/1167] io_uring: dont touch sqd->thread off tw add Date: Fri, 4 Dec 2026 18:50:57 +0900 Message-ID: <20261204100702.828695168@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pavel Begunkov Commit bd2703b42decebdcddf76e277ba76b4c4a142d73 upstream. With IORING_SETUP_SQPOLL all requests are created by the SQPOLL task, which means that req->task should always match sqd->thread. Since accesses to sqd->thread should be separately protected, use req->task in io_req_normal_work_add() instead. Note, in the eyes of io_req_normal_work_add(), the SQPOLL task struct is always pinned and alive, and sqd->thread can either be the task or NULL. It's only problematic if the compiler decides to reload the value after the null check, which is not so likely. Cc: stable@vger.kernel.org Cc: Bui Quang Minh Reported-by: lizetao Fixes: 78f9b61bd8e54 ("io_uring: wake SQPOLL task when task_work is added to an empty queue") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/1cbbe72cf32c45a8fee96026463024cd8564a7d7.1736541357.git.asml.silence@gmail.com Signed-off-by: Jens Axboe [axboe: 6.6 has no tctx->task, use req->task like the commit message says. With SQPOLL all requests are allocated by the SQPOLL task, so req->task is that task] Signed-off-by: Sasha Levin --- io_uring/io_uring.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 4c88bd805b8cb..3108af4514eb2 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1410,10 +1410,7 @@ static void io_req_normal_work_add(struct io_kiocb *req) /* SQPOLL doesn't need the task_work added, it'll run it itself */ if (ctx->flags & IORING_SETUP_SQPOLL) { - struct io_sq_data *sqd = ctx->sq_data; - - if (sqd->thread) - __set_notify_signal(sqd->thread); + __set_notify_signal(req->task); return; } -- 2.53.0