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 233D12E285C; Sat, 12 Sep 2026 14:06:27 +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=1789221989; cv=none; b=nD0cJdY0IvH0G6Zt7T18rgXPlBTbKNbXDYBVgX0KQsN2lhrBL1bdk+ptCu5DzB1iFhthwvRLg8nr+P8bzWjWQg0HD9uP4bEmjN+ql0rEskFSpo69PRooDet10aNr6wCqhkOQKrO8r67c9szRIqKjqPRkh46UYIRqO9c34+Dd9OY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789221989; c=relaxed/simple; bh=hcZlyF4Hd/rFNr58hDG17PgtdHhIiZKK5bTvTqLsIX4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Nml5lTpOt8gkSao1joJDfH3uJ1wmM6GgSCs2BQMw7bXtVflXBIYn3SBsegkPviSNBod7WDS9VPxaijOerz4FbRASNxaTeekUCcHwpA3rZ1Dy1aV8FhMweGKNBfl71bTKkYZ/H1cIA26CAIueXJYB1+BEjvMirV3NodsahGve+9U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kWNAfLb7; 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="kWNAfLb7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD25A1F000FF; Sat, 12 Sep 2026 14:06:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789221987; bh=EATj/9JNLsUWLJGcSCLDO1BbzhpOHHVcheTPgcr3FHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kWNAfLb7XOhG/Y5C/A9p1Oc47OJKpXd8yMFzQZ20k2fvn9KLTBayJ76joM/n1qp1K VjBlsPQzioOSpt4Jb1GS0Gh4GoL2EYY7r5+uEL9auKCdx3HxFD15WV5awW4KpEw7J4 1k29X3/T3wD12GAPk2/qCWpB75l2HIvVHl53notY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sashiko , Nilesh Javali , "Martin K. Petersen (Oracle)" Subject: [PATCH 6.6 0496/1424] scsi: qla2xxx: Drop vport reference under lock in report ID acquisition Date: Sat, 12 Sep 2026 08:48:48 +0200 Message-ID: <20260912065618.399706555@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nilesh Javali commit 1154b16439ffc562f9461494c4508c63446eb684 upstream. qla24xx_report_id_acquisition() format-1 handling takes the vport reference under vport_slock but drops it outside the lock, after setting vp->vp_flags and vp->dpc_flags: set_bit(VP_IDX_ACQUIRED, &vp->vp_flags); set_bit(REGISTER_FC4_NEEDED, &vp->dpc_flags); set_bit(REGISTER_FDMI_NEEDED, &vp->dpc_flags); atomic_dec(&vp->vref_count); Neither set_bit() nor atomic_dec() imply a memory barrier, so on a weakly ordered architecture the decrement can become visible before the flag stores. qla24xx_deallocate_vp_id() polls vref_count under vport_slock and unlinks the vport once it reads zero, after which qla24xx_vport_delete() frees it via scsi_host_put(). The poller could therefore observe vref_count == 0 early and tear the vport down while the pending vp_flags/ dpc_flags stores land on freed memory. Drop the reference under vport_slock, as is done for the matching increment and by every other vref_count user. The unlock release pairs with the deallocate poller's lock acquire so the flag stores are ordered before vref_count == 0 can be observed. Fixes: 793cedee296f ("scsi: qla2xxx: Hold vport reference in qla24xx_report_id_acquisition()") Cc: stable@vger.kernel.org Reported-by: Sashiko Signed-off-by: Nilesh Javali Link: https://patch.msgid.link/20260730155838.2119230-23-njavali@marvell.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_mbx.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -4167,7 +4167,9 @@ qla24xx_report_id_acquisition(scsi_qla_h set_bit(REGISTER_FC4_NEEDED, &vp->dpc_flags); set_bit(REGISTER_FDMI_NEEDED, &vp->dpc_flags); + spin_lock_irqsave(&ha->vport_slock, flags); atomic_dec(&vp->vref_count); + spin_unlock_irqrestore(&ha->vport_slock, flags); } set_bit(VP_DPC_NEEDED, &vha->dpc_flags); qla2xxx_wake_dpc(vha);