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 C149250B8B1; Wed, 30 Sep 2026 16:02:02 +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=1790784126; cv=none; b=LqGYAncqc70cwAA4Yr4jFUIli/s7L4glVciokygUtVDU0MSa2hUaWm5wbtZamnK64x8h1oKZ6R+SFXiEhSfTYcMj250lgA0XoECpDjj6S0PrNMEaXn6CJVpTDfum0+5wLkWA52nHzgzSYdMEcG5+0BbkmU3mNrX6PgrCsphJKGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790784126; c=relaxed/simple; bh=Uy7zlogM5tTAjDR5y49Wlglnzngg2qvCzXfahG6t5QE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mgqevlwigh74jPcCV/lsSy4svhJBj0uI13S7DetIWqBmhDtuMPEYclGVv/12ft3kr4e1wzVtRIVJDSpYPly65HMosXQ1H+m7SgWxa0b6lve5KBQdIR3OYqylW/HPrKTLziUau6A1IOtzRSj0BAcaZ8xZ/hCzbrvYDL3jEpS1sn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qtE5J/w3; 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="qtE5J/w3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 054DE1F00898; Wed, 30 Sep 2026 16:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790784122; bh=U18fW1jjwfNtrEfyC0y4PjQdUTPf60QAYBkOOsFUDzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qtE5J/w3QdR4dcb4GX8cuD2tDKnhQgelsH/GTmPa5K4IZ0PVdUeZgGCutbB43icDH TZb4fKusftc13gZ0whkVmqds4018EjeDZx1ypACwX5K+/WRFbjDFCgrdl6zkCvf9g1 Uyd8YA29eSgrBQ62kisoHPYT3V7pRv8hTwc5d/ec= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kumar Meiyappan , Sagar Biradar , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.1 044/982] scsi: pm8001: Reject non-fatal dump when controller is crashed Date: Wed, 30 Sep 2026 17:13:00 +0200 Message-ID: <20260930152417.742703364@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kumar Meiyappan [ Upstream commit aa3b8f56ef27ed72394a752820abdec4608b731c ] pm80xx_get_non_fatal_dump() can be called even after the controller has entered a fatal error state. In that case the forensic memory contents are not safe to access for a non-fatal dump request, and attempting to do so can trigger a call trace. Check controller_fatal_error before reading the non-fatal dump buffer and return -EINVAL when the controller is already in a crashed state. This prevents non-fatal dump collection from running in an invalid controller state. Signed-off-by: Kumar Meiyappan Signed-off-by: Sagar Biradar Link: https://patch.msgid.link/20260416154650.415624-1-sagar.biradar@microchip.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/pm8001/pm80xx_hwi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 2bf293e8f7472..371a33bab4c73 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -401,6 +401,13 @@ ssize_t pm80xx_get_non_fatal_dump(struct device *cdev, char *buf_copy = buf; temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr; + + if (pm8001_ha->controller_fatal_error) { + pm8001_dbg(pm8001_ha, FAIL, + "non-fatal dump not available in fatal error state\n"); + return -EINVAL; + } + if (++pm8001_ha->non_fatal_count == 1) { if (pm8001_ha->chip_id == chip_8001) { snprintf(pm8001_ha->forensic_info.data_buf.direct_data, -- 2.53.0