Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2575700lqp; Mon, 25 Mar 2024 03:13:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvAXa+axXZtuqfF0ZAqR3q+KsFE+EiMTIhQIY6KX4aVG8zXG8ETvliOCUSa6VNOS/fhzcH6jZUU/wYtUL0yPA4TO45t1cWpAjHwUupGQ== X-Google-Smtp-Source: AGHT+IH46wf2bWHoXciFQYviYYlK0iciyg/ZdDC4TuVfBH/EVayyCWWyTh03aT4wMuhms90AAGOV X-Received: by 2002:a17:906:e092:b0:a47:340b:dfda with SMTP id gh18-20020a170906e09200b00a47340bdfdamr4169637ejb.4.1711361606047; Mon, 25 Mar 2024 03:13:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711361606; cv=pass; d=google.com; s=arc-20160816; b=YFTrc5qq4BbJXG0CztoeLaNqaMyQUjj4wXNzhKticuwz6xrj5/0WeA3ihtIw8b+fEX ClMRbkRPPWjw3BT/dYPWHjdHFqxDRq56k8/61LMiSFFL3dyt7zwiA22w3uhLaCNmyD7/ DQaWtZpsEht91shuhmCfLSjT3ZhJTNk/kygB9qkmSrmia7P7IPjQQwdlZjkJ3pH+kCJT vohuCJD9WBEBNmxf1ecq7gtFfjQ93blI+PcBZCTmYkj5tmPoxaEdbbJrzOitn/tin6M0 dH1q4fnk0oWXEg7XIpCTmJaiedGdj9dp/FY2LR8leBxfEW0EIP2p1kduuv8ZvDvgrmdD BFkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eYC5nq3N8e/veIGKo3ql8YOuZQ7WyrJ7NXJObMi658E=; fh=Fgj1SW8phZle2igeg9J2l9LylFuyg+28f5+r3I3IboA=; b=ptsCFw0TpSwGJYV84vtrggX+v1uf0ZxqVnjOC9whthXj4B+aHFa+SNRM+5ttY8X+gr 1BG91+0FEvJDrii0rkFu9D/HxOd34x5GIedER/uphBf47+7PCBwmHz3SpMFHHXykKNp4 o0/nVAlknWihN2Kq7ZAtqFzo6sZSBtdRacqEnLh1H6XVnQkRiuLSLjCL7nEWOkJAHIDS acLbAHMwFwi4ap0JRAhdcfWK4h6WouFJLNxTuUY0k+Q0LaII1exjnZ7DcJqHMZhSiPtT rVPsKwg6+po+LonZaFIBX5QB2IdHkGf8zgAvYVW9Ja0o6RCJlvZF7You8wLPY9J4hlS9 pSsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DNVkhzZH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qk38-20020a1709077fa600b00a474c8399d6si1579682ejc.798.2024.03.25.03.13.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DNVkhzZH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C29CD1F310CF for ; Mon, 25 Mar 2024 10:13:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A71F3AFAA9; Mon, 25 Mar 2024 03:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DNVkhzZH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7E88B131192; Sun, 24 Mar 2024 23:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323684; cv=none; b=ayix6cW4LIpUm9WAXjo81CIYpMXBSxwdHUdyXMeUvo+92yy4v9q5ndUskeV4YjUldGExXf4duNFpKzMzIi2Do/lRnHy/ttW4tIGJ10VooRx4t+kNpcTrofM4AdlVuwaOBqCOJ4/z1M7M3nRNoIk505nOy+RXIoyB/fPYeqe8l7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323684; c=relaxed/simple; bh=koVwPrZQUSvcHiiHHSXm4PoGQaBqY7IyOELR1RuD3Vo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=auFFCrxOCh3NdCkyPlpLihq9hwGlxtCG/yN1H0YTLzJ25c7YN29WO73tY1px1y4B4GHeFfNzOsE2TlhHqJkSQH0mYgR9wqu74N3ZgKLPTz2yv2o2YkdzU7hSUzIer5f07bu2GiuJAR4nRQgWdMT6FznvmP7Fxq8LH+4x8nJfqqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DNVkhzZH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62FBCC43394; Sun, 24 Mar 2024 23:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323684; bh=koVwPrZQUSvcHiiHHSXm4PoGQaBqY7IyOELR1RuD3Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNVkhzZHJ+rAlFQxV9qXDbTKF/jWQydx3U7Bcs2AdVplET0ASRhVZ7WbbNOZjmNYc yWc2F11pro1FwPpe6lNXZigmMvzd3KCyKQovbjYSoRJenQhTKWDWBnBzudCDpXr4pM L+R2cgi3DS41K4jd4i5XVt67AHN23+tBwkOiiihaySdYUG1asHqSFPD/QeWsZNArK+ Q0vFEOgL6Gw9rfUoqtKz4BMVnA4Tl9nuVZcreF02yl6+lmN6p6pLppG339wEi0zX2I ErYI2pEBOD5eCMmh5qYsx4wQ4AY2fZ6ZZgKKz8axqFIwGZBaHWr07UAeF5LGyaA1r1 lJQO0pO2GgzLQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Gregory Greenman , Miri Korenblit , Sasha Levin Subject: [PATCH 5.10 056/238] wifi: iwlwifi: dbg-tlv: ensure NUL termination Date: Sun, 24 Mar 2024 19:37:24 -0400 Message-ID: <20240324234027.1354210-57-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Johannes Berg [ Upstream commit ea1d166fae14e05d49ffb0ea9fcd4658f8d3dcea ] The iwl_fw_ini_debug_info_tlv is used as a string, so we must ensure the string is terminated correctly before using it. Fixes: a9248de42464 ("iwlwifi: dbg_ini: add TLV allocation new API support") Signed-off-by: Johannes Berg Reviewed-by: Gregory Greenman Signed-off-by: Miri Korenblit Link: https://msgid.link/20240128084842.be15e858ee89.Ibff93429cf999eafc7b26f3eef4c055dc84984a0@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c index bcaec8a184cd6..299819d2d1904 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -155,6 +155,12 @@ static int iwl_dbg_tlv_alloc_debug_info(struct iwl_trans *trans, if (le32_to_cpu(tlv->length) != sizeof(*debug_info)) return -EINVAL; + /* we use this as a string, ensure input was NUL terminated */ + if (strnlen(debug_info->debug_cfg_name, + sizeof(debug_info->debug_cfg_name)) == + sizeof(debug_info->debug_cfg_name)) + return -EINVAL; + IWL_DEBUG_FW(trans, "WRT: Loading debug cfg: %s\n", debug_info->debug_cfg_name); -- 2.43.0