Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2367053lqp; Sun, 24 Mar 2024 16:04:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6zlFGArKlFxWd+mpjL0OAt78wbke5KtVYhnASsepXBe4Fd/95TL5s+n4ymUaXPVKPLGZniB6hN2PqFMzhwhEHzmMZqXX3T1pZHwPE+w== X-Google-Smtp-Source: AGHT+IGOjV+GheODFrVjR+9H7ZeBm+HGiFhBmpPpyS280LyfOtcIjVLlqEl93+zqOgHjGQy+yDa5 X-Received: by 2002:a50:99c4:0:b0:56a:fbe9:80a4 with SMTP id n4-20020a5099c4000000b0056afbe980a4mr3616127edb.1.1711321478377; Sun, 24 Mar 2024 16:04:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711321478; cv=pass; d=google.com; s=arc-20160816; b=DphXIOfpfcnhorF0sken0mL/3hjgucC9+DU3uq7181IXWzP+CrBjTNvnGoZNNY3GoP 60mtHFtXyh6hzZ3YUcMozB7phqFrBXv21pBYXdp+jwspEAXxxjCzJkzAm0IvZvcwkNOp w+AfU7C7rRrZmxkyu0Gmub1OVDazeT3UobnW7KR+ssqWeW/XvA2fg3iQ7tYRYSmiV8vD CSORQL8PEQuiOzAIyEGLUbGWa12mg9vuBk7/G2WBWkpX1TQUKnYBeprRhocaNj4KBlYd y+xTQRWARJtJlnDkgMujAtySyda6bpovq5BY/QjVN0u4avJyoAiXVggALzCxXX2khiA4 VzGA== 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=lZtD1t6uAg11S6TX1F1xQm9whfqXA+xmJnppfAM4pNc=; fh=Fgj1SW8phZle2igeg9J2l9LylFuyg+28f5+r3I3IboA=; b=WFcoAuH3O0U0g+hR9LZaLaSsXDEMKepwN6Jjmp8CaWYSCiLa6iIvamjHUWT0N/Fhp0 NIloR2N172riR45iCh0+U5znoJkC5kZPi4r5/o/7dSFlQQKnZnxWSxAC+wIcT+anpXJj MhbbqNKpEOSD4HSKQ7f70SDOiQf9P7dok/8278WWBOlPJBgX6D60jZMoGQ0kdtjjcyfq aoS4lzuUqHsr2s1ASWPNC5xXArVN1SY2vfO88hMzvUaTEo58h83WByAvZjm5rblctykn KwsEIfG2IzfL9yqArMs8GaxavGBAXp1Il2PTjQFP16uAgLYXdnrDytudIZTuUvq1T8lC KArg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=so3dOg46; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113013-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 r25-20020a50aad9000000b0056b849263c3si2057711edc.438.2024.03.24.16.04.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113013-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=so3dOg46; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113013-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 1BCD41F261DA for ; Sun, 24 Mar 2024 23:04:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 700AB13541F; Sun, 24 Mar 2024 22:37:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="so3dOg46" 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 83B294D9FE; Sun, 24 Mar 2024 22:37:04 +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=1711319824; cv=none; b=L0cvC+K6KqywiiDNj1V0wKA/pDbRZWHs0CIs6ouph3FFvverdgl7uVztOQfTxluCGz7H4j3cyqe6lgU/70PVHG5DGmUavrG/fDzDzbwWMsyGO2hjtPVKj9E6imZPjDmHM+bHr+68xefH2Pfu2wCjfAOMPp4R76HMH1pXuIoKo2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319824; c=relaxed/simple; bh=KO8U+3kFg3Bhq9PhySBL+icUpyYJRdIbG31x0XFRssg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KOHjQshuQ+dBp/BhmmbtzxqxVlqv4zd8eUr5BJnA9zHSOQEuv4kB5dwjX6MWkzYftraXMKV6ZD9I57F7UJuwFu3/c4p8iZz0uqZrXMHfs3EabaTXjqm+kgtlpDV33RuoPdsWBpRi2vW9OeOVGzXVynYIWkUa0euMiQupfXQfKfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=so3dOg46; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B547C43399; Sun, 24 Mar 2024 22:37:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319824; bh=KO8U+3kFg3Bhq9PhySBL+icUpyYJRdIbG31x0XFRssg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=so3dOg46Wus2pk/VDih58Kpi9JxT+iokXS6HtoOxaQYdinYQOXhbaoyJBWQUhtOND iMDmzssIVWp3jkV+COCQT8hnm7e0l4n9yL/v3PRqpYYwD+70bk+Imy456/2Xn9S8V8 l1MMaDeFzjCPM74V+PldDplnOsTZP/dC04ySm4gm6CAGFtdDGLnDjsI3dRIPVbULmT nMR6/eyX0xHAqQHL4qmIlM9GUc0+C+jtgYXvoJdcE5wLAV9mf9s4KmoIwsaiHHy9jy EbieDA939jliej59EUSVpDmz9bf7NyYQ2M1hV1ODaKyRBlCvH7vCz2HHByP3fobFcJ Vuulc65JfxCKQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Johannes Berg , Gregory Greenman , Miri Korenblit , Sasha Levin Subject: [PATCH 6.8 126/715] wifi: iwlwifi: dbg-tlv: ensure NUL termination Date: Sun, 24 Mar 2024 18:25:05 -0400 Message-ID: <20240324223455.1342824-127-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 72075720969c0..3442dfab50b53 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -103,6 +103,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