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 6B80932ABC0; Thu, 28 May 2026 20:11:33 +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=1779999094; cv=none; b=UHBYFt9hHl/vjf+IhRF6shJ2GL5W3Z4yggpGTl6xQ7nqHoAnE7imhWWuk+8N/W0g5nPhqAaTFl/fjauamnHbLea0BO5zN1ZByJ9JqOlLCmHmSVaReIgqBGJvGS2JBY4wABhsU1DxcC04+hOuD5QVKfgSkzkGtkeULuVb2+woJ0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779999094; c=relaxed/simple; bh=GOLeDGq/P0pox/fYvDajz7pFyAVGwh6lcggUcjZmbJU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rhskAMhcTOlcXDgMQqCodtErmd7J1OjfLdyPE8hWUyKyYl4HFKK62mtUeaYMEaeMKhcb3DDbaHRnTb8ARgoMiCNTdClLNSpO3wMWdaYItTBogUcRK4DdEhksOFaXXYoyQAyfP41UyvC9+bF7+24FEycNqtt/QXVfmq3FUAYybc4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wqgOANNW; 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="wqgOANNW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C98DD1F000E9; Thu, 28 May 2026 20:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779999093; bh=CqT1mDtDrMS49Dt+h5i98A1d9ULApvv/gO7AAY9/Tic=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wqgOANNWI4IEvYRYHLLSY5HU6DMVeczkk+12KSxHjzx+O+bn3OhcKHHDlND20hAz3 W9NLH13ks6EOco1CApGM3S8O9qQ3MksTNUMfZ6cKuRagOH6rZ1hL6hykzJBTeoJRvL I3v0SX65bschwt8EEEMTHHsZR0vB073nwvBe2YGA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Nikhil P. Rao" , Jakub Kicinski , Sasha Levin Subject: [PATCH 7.0 407/461] pds_core: fix error handling in pdsc_devcmd_wait Date: Thu, 28 May 2026 21:48:56 +0200 Message-ID: <20260528194659.263521644@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194646.819809818@linuxfoundation.org> References: <20260528194646.819809818@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nikhil P. Rao [ Upstream commit 0e46b6635b03d29807f810c3b415c4755a3f958d ] Fix two cases where pdsc_devcmd_wait() returns stale success from the completion register instead of an error: 1. FW crash: If firmware stops running, the wait loop breaks early with running=false. The condition "if ((!done || timeout) && running)" is false, so error handling is bypassed and stale status is returned. Check !running first and return -ENXIO. 2. Timeout: If a command times out, err is set to -ETIMEDOUT but then overwritten by pdsc_err_to_errno(status) which reads stale status. Return -ETIMEDOUT immediately after cleaning up. Both errors now propagate to pdsc_devcmd_locked() which queues health_work for recovery. Fixes: 45d76f492938 ("pds_core: set up device and adminq") Signed-off-by: Nikhil P. Rao Link: https://patch.msgid.link/20260515212907.998028-1-nikhil.rao@amd.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/amd/pds_core/dev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/dev.c b/drivers/net/ethernet/amd/pds_core/dev.c index 2e1d0d01d03af..bded6b33289ce 100644 --- a/drivers/net/ethernet/amd/pds_core/dev.c +++ b/drivers/net/ethernet/amd/pds_core/dev.c @@ -162,12 +162,19 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds) dev_dbg(dev, "DEVCMD %d %s after %ld secs\n", opcode, pdsc_devcmd_str(opcode), duration / HZ); - if ((!done || timeout) && running) { + if (!running) { + dev_err(dev, "DEVCMD %d %s fw not running\n", + opcode, pdsc_devcmd_str(opcode)); + pdsc_devcmd_clean(pdsc); + return -ENXIO; + } + + if (!done || timeout) { dev_err(dev, "DEVCMD %d %s timeout, done %d timeout %d max_seconds=%d\n", opcode, pdsc_devcmd_str(opcode), done, timeout, max_seconds); - err = -ETIMEDOUT; pdsc_devcmd_clean(pdsc); + return -ETIMEDOUT; } status = pdsc_devcmd_status(pdsc); -- 2.53.0