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 AFA43440A13; Mon, 17 Aug 2026 14:54:31 +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=1786978473; cv=none; b=b0+zKMhEwdtmJY9/UrGrqq3S9kCCp5ICTUn94uda23XltW+2GxtNKI7rugsocZCqfqoUMUSQrfXhdy6t53zP8lp/XampC97sCrq9i6z5yoelk1TRcJkMfh/ySqG4GOPvCDMll0CR2/XKrVPH1DOqei96nO4KVIFH+2c5Fvm7ADk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786978473; c=relaxed/simple; bh=sfB3CZUsma8w26h3qpXRIhMmg50+luNPC98YOcxbm1E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YIIbJg8Y4o/j1RNrrPAf336mCA9G/MoxH8IdSy4nGIvzscywim2/5GcjtRR03F0i6FKRO3SLP38QKE8gP2wfWIMrtRcN2g1xK/k1WT6YXs557Tnl/RS7dxFsx8t4WIsYtSo/uADS4WM+4nRO8tvz30B2kF7FoPunhosGOag3ve8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eys8LgX7; 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="eys8LgX7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253741F00A3A; Mon, 17 Aug 2026 14:54:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786978470; bh=EdFeVyembkZTq4n5ginMOlcjp2EcZDN+M7Oga3gaqtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eys8LgX7CtYjTqtmaWbZ8jCvyKBdtz66lUpb4tSuk6JTfBMBS8waSVu9dqUK8yAQW NXzinXfkCrSc2G8loZBV3bhNHSIzpGqYvWsyFqdkZrn4XixzDWYAd+MCdJLnScXJ46 LoYQ9TdD8wx1bu8vIyVkEcfPzhGs8/YRHQOziMb4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pengpeng Hou , Elad Nachman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 049/156] net: prestera: validate firmware header length Date: Mon, 17 Aug 2026 15:33:03 +0200 Message-ID: <20260817132536.511246599@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132534.666299318@linuxfoundation.org> References: <20260817132534.666299318@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: Pengpeng Hou [ Upstream commit 8ae344eb540af3f457179b52bc6061416752485c ] prestera_fw_hdr_parse() reads the firmware header before checking that the firmware image contains that header. Reject images shorter than struct prestera_fw_header before decoding the magic and version fields. Fixes: 4c2703dfd7fabb ("net: marvell: prestera: Add PCI interface support") Signed-off-by: Pengpeng Hou Acked-by: Elad Nachman Link: https://patch.msgid.link/20260731141500.1-prestera-v2-pengpeng@iscas.ac.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/prestera/prestera_pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_pci.c b/drivers/net/ethernet/marvell/prestera/prestera_pci.c index 35857dc19542f..5db2c9e5e077d 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_pci.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_pci.c @@ -684,6 +684,9 @@ static int prestera_fw_hdr_parse(struct prestera_fw *fw) struct prestera_fw_header *hdr; u32 magic; + if (fw->bin->size < sizeof(*hdr)) + return -EINVAL; + hdr = (struct prestera_fw_header *)fw->bin->data; magic = be32_to_cpu(hdr->magic_number); -- 2.53.0