From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37F9E3D7D74; Thu, 16 Jul 2026 14:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210814; cv=none; b=Mmm5++QF3hohx88e216WCnnueM9UcsFZ8zS4elh82yGvtlrIcagkotiM6zdBDJvYfaexi6tCFrnfH/hlcQDcvG/gIALICodmefH89MskTxPiDS8VY6v3gtcFhX2FLp7HI3eLjRwrSNhaKnm6uPhl0DMN3shaLNK6+91m8H+SQls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210814; c=relaxed/simple; bh=XBdPf/jBCRcM4qekZn+XnkPcuFRhy9Q8FTJE3O4zUZc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qYYI9rn182O3cvtoGhCEKtovtyQt+6YAJNPl1KlWBK4QF0S49VH7Yvg+FiX/q3UTA+Rug9Wvz9o6C7LH6wv/www+Dy31224PqAtDitP7KycZAALmFWp4MoQHloq9BN1HUbcF7H3ysKQlrWpgXMacT6k4jF26TA2sYGPbREGIOg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=abkClHtE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="abkClHtE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C5821F000E9; Thu, 16 Jul 2026 14:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784210813; bh=UM29cagCPF0bBij8aZTBx2/cat/vzPXyGfOP1T1dWms=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=abkClHtEn5oHyHbG3RtlGhsX+Lqkl+bKfP9ra2iW2Sw5DFdbyIvw+IZElDLaVL3WT 5+ICit454NOMs6bn3U0cIvhac7VciswL+XM45P0sZQhFNvjOW51g2CkKXN647C6nkh AdoQhy7p1owG3QwsWyxWGmDI4rVo+vDD02rD7sms= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Runyu Xiao , Jens Axboe Subject: [PATCH 6.18 183/480] io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item Date: Thu, 16 Jul 2026 15:28:50 +0200 Message-ID: <20260716133048.682716850@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133044.672218725@linuxfoundation.org> References: <20260716133044.672218725@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Runyu Xiao commit 29bef9934b2521f787bb15dd1985d4c0d12ae02a upstream. commit 10dc95939817 ("io_uring/io-wq: check IO_WQ_BIT_EXIT inside work run loop") fixed the obvious case where io_worker_handle_work() took one exit-bit snapshot before draining pending work, but the fix stops one level too early. io_worker_handle_work() now re-checks IO_WQ_BIT_EXIT in its outer work run loop, yet it still snapshots that bit once before processing a whole dependent linked-work chain. If io_wq_exit_start() sets IO_WQ_BIT_EXIT after the first linked item has started, the remaining linked items can still reuse stale do_kill = false, skip IO_WQ_WORK_CANCEL, and continue running after exit has begun. Move the check further inside, so it covers linked items too. Note: this is a syzbot special as it loves setting up tons of slow linked work on weird devices like msr that take forever to read, and immediately close the ring. Exit then takes a long time. Fixes: 10dc95939817 ("io_uring/io-wq: check IO_WQ_BIT_EXIT inside work run loop") Cc: stable@vger.kernel.org Signed-off-by: Runyu Xiao Link: https://patch.msgid.link/20260527172203.2043962-1-runyu.xiao@seu.edu.cn Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io-wq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/io_uring/io-wq.c +++ b/io_uring/io-wq.c @@ -601,7 +601,6 @@ static void io_worker_handle_work(struct struct io_wq *wq = worker->wq; do { - bool do_kill = test_bit(IO_WQ_BIT_EXIT, &wq->state); struct io_wq_work *work; /* @@ -637,6 +636,7 @@ static void io_worker_handle_work(struct /* handle a whole dependent link */ do { + bool do_kill = test_bit(IO_WQ_BIT_EXIT, &wq->state); struct io_wq_work *next_hashed, *linked; unsigned int work_flags = atomic_read(&work->flags); unsigned int hash = __io_wq_is_hashed(work_flags)