Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2555175lqp; Mon, 25 Mar 2024 02:25:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgcIPvmOHXhM1L7P3a+vSxTLAwspGOvYUgVlPdXaYICu2KdpPA0ZHYJI04q27vIKVkqIheCBU25zDpn1fq4riwOSVewcEyeyonBUZ6aw== X-Google-Smtp-Source: AGHT+IHSFw+snsZxHvml1ijc6ayJvdUnc9j0flDUqYmA7YGQiEb7WygsN/oXY5oMi3BWn801FiAE X-Received: by 2002:a17:902:6808:b0:1dd:a3e2:de77 with SMTP id h8-20020a170902680800b001dda3e2de77mr6732159plk.20.1711358735275; Mon, 25 Mar 2024 02:25:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711358735; cv=pass; d=google.com; s=arc-20160816; b=NvaWuGDzPcntEmEXSUv+he+bKxsPW180ohzKWTJ6Ny8HKMJCcBuhX+0G79d8gJIcwJ oXpeS+0yN3R8P6yAbOCm8pbXsX+EQioW0yiFRx9zKGC1r9CgPPUoBnfQJdTDmkqT5VeU vGQ9AYoT/SE0pONePMPWQZ1xQOSx0HyLs2b7n0JsbT26RTGVljz3Hk8Wc3lLe27q/A3y jN/6S/0geU1Xh4HgUhPeqSNBf+jb6H+GLRXrIYo6zxc4uhS/0G7xoqsvUcHFTVvgr7iI iskmxZQWpRbq3/IXScxz4Ve+VzP+KtCXUKh/xdxBQp/dU+oaVdTfLzgpqeQiq1vABE8b nJXQ== 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=gCBZ0hfhkLv9DdHd3RUKxN+HwiTpyWQacyN+76MOOcg=; fh=Fgj1SW8phZle2igeg9J2l9LylFuyg+28f5+r3I3IboA=; b=wI4giqHbC+NWE0N5G67mzOhwl7dabfePjOS73jgXOpNqvuFM5R5bJ/DNL6btKsGCq7 yC+T+AFZn9UD/2RR/19pI3X6Yh0yOdDwQaC+bo5ojmiZ5T1eiUtcXqfih9sTPUp6umbd n3KNurmm32gFlfgiNUQJ0gPZhG087kHTTzO92Y75rLvFzP6BuMGf52XsuWamG0Hm5sSl qaKC16XjrilMFzFL4o8AwNLR1vfVmqjPWqTUFyuSh1Jh53rbv3KLQllbAIbUY6fl2yAU pJRNh8JlhnbgKhTK+0ORrFNe2NACMq1GZElZ5FpChGAKBgc/OcYZoaQ3hrbQf3eMJkOz hzzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TIUI9NNw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115800-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d15-20020a170902654f00b001e028766f04si4842581pln.537.2024.03.25.02.25.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:25:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TIUI9NNw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115800-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115800-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1BB8429DDF7 for ; Mon, 25 Mar 2024 09:24:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 581403736E2; Mon, 25 Mar 2024 03:01:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TIUI9NNw" 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 2DD21145FE7; Sun, 24 Mar 2024 23:14:05 +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=1711322045; cv=none; b=QkejbkkwV6zSc7geVR4r+BAZieU6jqUj4Df63Aghx87VEoYL4HVocm2XhKB2t2sjw8XLRDB/QoAuz8WbrtHFLmx0BBgndsZCp9KjEZ2Xlm3lykElISTPeJBmv3QshcHDCNyCx2zpAoI0BH29OVGsKoiQhQ0LiDKZVf/2dMYFCfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322045; c=relaxed/simple; bh=BQQFxfC6hnWa2hVMYnRycBC5lDGGb9w3JnhkFlXJojA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MaceHvq9jNp2325Pn+4QeaIz7Erap8tKGzpv0f/9KTuPgXUVqV7PZ3n6oVI2uYVcWRTJoT39biwKz+BaJ2P+RObA9s9r5Vpy4MwAGO8jy2P8uDLd6iwPB3OoJI7r+lQ+reBF5TMcobvksvxlYtxmge55NHl9pr23fFD293osyYk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TIUI9NNw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53816C43394; Sun, 24 Mar 2024 23:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322045; bh=BQQFxfC6hnWa2hVMYnRycBC5lDGGb9w3JnhkFlXJojA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TIUI9NNwyk+s8U/wBeV6kfhfibp9d69MiSUM/8eSGFSkdxAgXv5HWG5NSYk3ezWev DIHKTtU3kDTDi5hqyUWrzw7gsiSKKWTdVTA8yOnb5hW6FWo3lMfkj37OsrhQ4oGz+B QWS7TuMW4sRRLFLaoTO5xS97eV9UPB6IK3sYkBvuepW9QiXmcfLv2fe4X6rns0D48n BIAfNadX2AbXYXzCSKuKIbJXXhSkd34+zz0D19IS6Iaw3WeLE+xM88/QQZnwK7ldaL D6pGVPVa0To8CYXiAAhbeoVnFmeXt3YzqZJ7Hm2Z80T+hSasNHaNP+8P5Z8bgo61it /ocSOrZpqXuBQ== 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.1 117/451] wifi: iwlwifi: dbg-tlv: ensure NUL termination Date: Sun, 24 Mar 2024 19:06:33 -0400 Message-ID: <20240324231207.1351418-118-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 5979d904bbbd2..677c9e0b46f10 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