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 E7A8535AC09; Sat, 12 Sep 2026 10:15:19 +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=1789208121; cv=none; b=kPuG5FnvPb0k4gQ0Oha2UTZwLDH/OuNbfmkv4moyfzxQ4CFYkhvPNO3kEeCkxCe8+7Lski1hR1Ffg8jsaM73TGm6JOpUfkmfmGfiVrgenjvxn6qEphbDo/ojL8K9M5ruYRo9xx/56yHkPPCWyl2CzlyGQpcNEXvZICyo4xOhMe4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789208121; c=relaxed/simple; bh=cx0KPW/yxgYQyoDLuLzt+bvn+H4N5yKWycJ1Com9nBU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dX+XQFQCGMoa3JvOHXm5R36jB6bJCg+jAyb6N+dhEbn7Agl/zmn957d3X+qeQ+yM7DY9TBQMygP3CbfCtg8kiJwX9NDg3+bC6Zbp+bxDMFy6kywe2wV/ndmq7CeyK0ptRrASnab+qinQUm8ixNR32QhkgvlwgQgmgOVn+nmoN4k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oICKq+XM; 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="oICKq+XM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFFFB1F000FF; Sat, 12 Sep 2026 10:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789208119; bh=rAUGq5lkQf1vqKApd3DFFnxGaK3+ofkLO3mPXIotO54=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=oICKq+XMfbcsFFsELsi+AMd8/du7BpraAI4A5WVbLLi1I/aqauxgkp69+/wEzsb8M UaEukAYx3btFLW06rgR+HDrSmebf+d3cEtz+T6sbeo8QIiJjmq2PgApDkJ1QFfSXRm FkOzHSWiYkCG/fA5WaXOA6lJxn/hZTR0rcC9CJ60= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ijae Kim , Myeonghun Pak , Cheng Xu , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.18 0510/1518] RDMA/erdma: Fix CEQ tasklet use-after-free on removal Date: Sat, 12 Sep 2026 08:44:39 +0200 Message-ID: <20260912065634.982090317@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@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: Myeonghun Pak [ Upstream commit 0ca79979384f031d710c4b3bae065dcb5d95aca3 ] Each CEQ interrupt handler only schedules eqc->tasklet. The tasklet calls erdma_ceq_completion_handler(), which reads the DMA-coherent EQ ring through get_next_valid_eqe() and updates eq->dbrec through notify_eq(). erdma_ceqs_uninit() frees each CEQ IRQ and then destroys its EQ. free_irq() prevents another hard IRQ and waits for an in-flight handler, but it does not drain a tasklet that the handler already scheduled. The tasklet can therefore access eq->qbuf or eq->dbrec after erdma_eq_destroy() frees them. Clearing ceq_cb->ready does not synchronize with a tasklet that already passed the check at the start of erdma_ceq_completion_handler(). Kill the tasklet after free_irq(), when no handler can schedule it again, and before erdma_ceq_uninit_one() releases the EQ buffers. Fixes: f2a0a630b953 ("RDMA/erdma: Add event queue implementation") Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Link: https://patch.msgid.link/20260721082545.47395-1-mhun512@gmail.com Acked-by: Cheng Xu Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/erdma/erdma_eq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/erdma/erdma_eq.c b/drivers/infiniband/hw/erdma/erdma_eq.c index 6486234a23600..5610e7f4c6bf7 100644 --- a/drivers/infiniband/hw/erdma/erdma_eq.c +++ b/drivers/infiniband/hw/erdma/erdma_eq.c @@ -219,6 +219,7 @@ static void erdma_free_ceq_irq(struct erdma_dev *dev, u16 ceqn) irq_set_affinity_hint(eqc->irq.msix_vector, NULL); free_irq(eqc->irq.msix_vector, eqc); + tasklet_kill(&eqc->tasklet); } static int create_eq_cmd(struct erdma_dev *dev, u32 eqn, struct erdma_eq *eq) -- 2.53.0