From patchwork Sun Jan 28 06:53:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Korenblit, Miriam Rachel" X-Patchwork-Id: 13534390 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 78C21DDDF for ; Sun, 28 Jan 2024 06:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706424891; cv=none; b=tiHqNVmeSfT+UkxRpZaOs1vA+9aT3QMFZ4b9Ys7ro6tWlmhdip56PseeN4K4vtzwsx9jYBehe6tg6jYK5V5qrJGyCRNZ1s7WIRk421XWkvtHsE4nsTn6Qv9x46A553feJsUriOQCl3xoPwFvgK5yhIGiyzGDcO3QyopKmnZS71E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706424891; c=relaxed/simple; bh=0CCVW+mJK2ARsfZcm9KDeKt69x0VffzVJWtOS1Bc+9s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=asMiDzFSH6vBlInluaVFzTJGmDTyaqYLu8a2+igoYTwcXdf14p5uIM7dL1zcyjcGkJncl4SOV4eu15ymnxOymWW5Cz2V/tFtIYHlA33vAVSZMoAjsKjQ/OsltXcgbbYfd0pvYqPEI0jrY71mdHcxd5ADSIzdCy5pd12ifw0spKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=cdXHqFQP; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cdXHqFQP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706424891; x=1737960891; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0CCVW+mJK2ARsfZcm9KDeKt69x0VffzVJWtOS1Bc+9s=; b=cdXHqFQPdFsAPpdZrcV23g6ZO8UehMd4Kg6HeTnQmTGk1Wlyn4kFrZzm XqVA09+8os0/5LaQrijNYkx0flZWBn5pJY+VehbI2ZH85q0Cstz4gxB8N ZPETBwoNByJdVPMn3NUUIFIhpGQRW8mxPyEXBiiYvDhtA3Vd11pQqMFHp s3tz042ur+pjGivRNsSKZnvDks1WQLHo3kiCwfou+Fb5P7zuCG7W4Jpz/ E+LxuOAd4XQ+U4K2ZRJj8YKVOgKLYvYmwzC5a3zyZlHNIhNKQFOlWKQME lKH008hEVBnyriteje0kKTqhDv+AYw3mW1zy2aIONZvlJ2qMzVY1Q0taG w==; X-IronPort-AV: E=McAfee;i="6600,9927,10966"; a="24217663" X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="24217663" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2024 22:54:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="35833357" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2024 22:54:48 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 07/14] wifi: iwlwifi: dbg-tlv: ensure NUL termination Date: Sun, 28 Jan 2024 08:53:53 +0200 Message-Id: <20240128084842.be15e858ee89.Ibff93429cf999eafc7b26f3eef4c055dc84984a0@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240128065400.2550604-1-miriam.rachel.korenblit@intel.com> References: <20240128065400.2550604-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited From: Johannes Berg 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 --- 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 989b100ce6ab..6cfcf1c14eaf 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -104,6 +104,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);