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 71866534443 for ; Wed, 9 Sep 2026 11:25:09 +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=1788953110; cv=none; b=YqQaXVYQA4D3ij+jFfai0muoq4SyTiH2wwAoWMTH2E0E3uB2n6mZZrAdau8Fc+saY/0CDMcq3R98cTY7hI0zyfBq1Ug7zxHtNP6P8KWLDGFmrYCrIkECulTvo/t5HGo7dxv2GPrFw/Mb+hrSZj2/Ti9b7j14Vu919UdCxdkHlfw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788953110; c=relaxed/simple; bh=5QKClxOF6xJqSJt7MXyhk3z4PAKSnkVp6FPPqDNmXfA=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=Pisiv/15dKju1qunnfh2ua/cbT6dxsAv+PZkxjn4pHOpV0x7KH4aZ634dbEc/j5te8lTZFIq9jOxk6AXi7sWQDkGe5nOsr74M+a4SBfrXzqprAWATp1tR2Q8cs7CmZVRQzWaahnAR21WQqpaIZP5VX5kVA/m2GyGwUj57XB3hyU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cyfpVYol; 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="cyfpVYol" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9CC31F00A3E; Wed, 9 Sep 2026 11:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788953109; bh=YB1gv4iJuqBZJMMTi12GIJ6ulkzbC6writyzDQpGjzE=; h=Subject:To:Cc:From:Date; b=cyfpVYolMSAMjIAp2KLxt7EBvEToBLMJxCPZxZLinIfG6IVZ7JTn0ZIF06EqBO6Tp V77xuC/ytKTXTAu20PuFhdlQ3s1nCZPACjhItN70iLHxMdnJk90Xe/lkFKLAx7wpd7 4aqQJ3fW14eR2KsonxvSJVqEIVqwxz+7Cp/87Nb0= Subject: FAILED: patch "[PATCH] scsi: qla2xxx: Fix use-after-free of qpair work on queue" failed to apply to 6.18-stable tree To: njavali@marvell.com,mkp@kernel.org,sashiko-dev@google.com Cc: From: Date: Wed, 09 Sep 2026 13:17:18 +0200 Message-ID: <2026090918-basket-habitual-e78a@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.18-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y git checkout FETCH_HEAD git cherry-pick -x 19788a55cab61d78e33e0914a5a31d27843e8a4a # git commit -s git send-email --to '' --in-reply-to '2026090918-basket-habitual-e78a@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 19788a55cab61d78e33e0914a5a31d27843e8a4a Mon Sep 17 00:00:00 2001 From: Nilesh Javali Date: Thu, 30 Jul 2026 21:28:09 +0530 Subject: [PATCH] scsi: qla2xxx: Fix use-after-free of qpair work on queue teardown The response queue MSI-X handler qla2xxx_msix_rsp_q() schedules qla_do_work() via queue_work(ha->wq, &qpair->q_work). qla_do_work() dereferences the qpair (vha, rsp) and takes qpair->qp_lock. During teardown, qla2xxx_delete_qpair() deletes the response queue, which calls free_irq() in qla25xx_free_rsp_que(), and then frees the queue and the qpair. free_irq() waits for running hardirq handlers but does not cancel work already placed on ha->wq. A still-pending q_work then runs qla_do_work() against the freed qpair and response queue, causing a use-after-free. This is especially likely during full adapter teardown, where destroy_workqueue(ha->wq) forces pending work to run after the queue pairs have been freed. Flush the work item with cancel_work_sync() in qla25xx_free_rsp_que() after free_irq() has released the interrupt (so no new work can be queued) and before the response queue and qpair memory are freed (so the flushed handler still sees valid memory). Guard on rsp->qpair and ha->wq to match the INIT_WORK() condition and avoid operating on an uninitialized work_struct. Fixes: 68ca949cdb04 ("[SCSI] qla2xxx: Add CPU affinity support.") Reported-by: Sashiko Cc: stable@vger.kernel.org Signed-off-by: Nilesh Javali Link: https://patch.msgid.link/20260730155838.2119230-5-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index b7d9c1a53f3c..33bfc61d8165 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -606,6 +606,10 @@ qla25xx_free_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp) rsp->msix->handle = NULL; } + /* Flush any queued response work before freeing the queue/qpair. */ + if (rsp->qpair && ha->wq) + cancel_work_sync(&rsp->qpair->q_work); + if (rsp->ring) dma_free_coherent(&ha->pdev->dev, (rsp->length + 1) * rsp_entry_size,