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 7E8314F392C; Thu, 17 Sep 2026 18:07:38 +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=1789668459; cv=none; b=BaXVWABia2aRPk8qesgBaVymqBqu25kgzU2ugietxR65ORX9F3WBxkhoU5aR+5veokInuJW+61tSKBB+lqkLaNa2Y4Ah1XCsa5R0eVKD05Sde2vr+5b4YhF3da3aOsE5aiXn+EGuAreMTAZXzSXs8sSLbGCeD2qwDMcvXph8SZo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789668459; c=relaxed/simple; bh=0igT6B63aRK8fLCxCFStS4BIaWUyuAGEGeYQAr3RO5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JYgox3N2iLK9YrfiOtO3fjYoSytzAuV1JBLNnPTXwD8ohGU3yvFcy8NKrJPn7gGL1r2TyOKWCWq7iCwEMjNmClHQJ4e5zxQn9rS+FP/MhuvJ+i1dDXtJnl408mzKaQsV8TLxW6RM1cjQ6Gwg6CsJ+JaK9hc3RSJIPcFVCoBE79g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pN2BAh9P; 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="pN2BAh9P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D86BC1F00893; Thu, 17 Sep 2026 18:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789668458; bh=1SrSeGZ8plFw84GaFlTMbLlxRIrnupu++W9keyQa9TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pN2BAh9P0ltEOMhx3Bqv7D4GMogPgUVEf6+wPHoOXhnVWb/A23H1Pvxygvcntii1f ZYXZyhVfy5atHHVHhV6wRA3jULKQX/vFthOP6fIJvWmLKjNZhKYNrUUque9MidwmGx PqAeymhyMohjVVqgfL6ckNbwrd4+44R9zSysFICc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Emmanuel Grumbach , Miri Korenblit , Sasha Levin Subject: [PATCH 6.12 0432/1102] wifi: iwlwifi: bound aligned TLV advance in FW parser Date: Thu, 17 Sep 2026 16:06:15 +0100 Message-ID: <20260917151550.519480570@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260917151539.408551884@linuxfoundation.org> References: <20260917151539.408551884@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emmanuel Grumbach [ Upstream commit acad742714bdc70e7fd7f234323807c596828213 ] Validate ALIGN(tlv_len, 4) against remaining parser length before consuming bytes from the firmware image. This avoids length underflow on malformed TLVs. Assisted-by: GitHubCopilot:GPT-5.3-Codex Signed-off-by: Emmanuel Grumbach Link: https://patch.msgid.link/20260717173215.393c286488f9.Ia39144dc3ca334325ee4eacb7420901e2446fc23@changeid Signed-off-by: Miri Korenblit Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c index 754e01688900d..c7c21c79a7436 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c @@ -706,6 +706,7 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, u32 build, paging_mem_size; int num_of_cpus; bool usniffer_req = false; + size_t aligned_tlv_len; if (len < sizeof(*ucode)) { IWL_ERR(drv, "uCode has invalid length: %zd\n", len); @@ -754,8 +755,16 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv, len, tlv_len); return -EINVAL; } - len -= ALIGN(tlv_len, 4); - data += sizeof(*tlv) + ALIGN(tlv_len, 4); + + aligned_tlv_len = ALIGN(tlv_len, 4); + if (len < aligned_tlv_len) { + IWL_ERR(drv, "invalid aligned TLV len: %zd/%zu\n", + len, aligned_tlv_len); + return -EINVAL; + } + + len -= aligned_tlv_len; + data += sizeof(*tlv) + aligned_tlv_len; switch (tlv_type) { case IWL_UCODE_TLV_INST: -- 2.53.0