From patchwork Thu Jan 11 13:07:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miri Korenblit X-Patchwork-Id: 762174 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 61FDCEAC0; Thu, 11 Jan 2024 13:07:35 +0000 (UTC) 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="AZWFmp/o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704978455; x=1736514455; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JyOWSBPF19QDkDIcdyM5RJ//TjolSWLTjGfiBY87nPY=; b=AZWFmp/oI6D1OeXluE4EeB4LIIH/OJm9krhdiBRnkdA+7jAHRerxl3Gn Yg916jxbScTROpZNsql7AsfpHqKumc4A2bvbGFa3YGM3Nq091LrRgtZyh wU93Lv/1+IrYJyGgz9Qx+K5AghSgodRRkHT/gMqofknF8ecYGcbVB1nf2 wXejxjziLJcx1UfsED6O/TQB+lyqdSEArIu3lWbkjqsGNO90D9pOv+qJM lnFwrG40KygknQrgzTjbUyUgzQJoWDiI5NHKJlnZ1Ut2CNdOct+GqsI5n a0PXLS9rfuaWrgA+SzWlXq5Y9PHqQ+Ifz3EufiUpP/mWeA7xSzl6tcrrk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="389278795" X-IronPort-AV: E=Sophos;i="6.04,186,1695711600"; d="scan'208";a="389278795" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 05:07:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="782637317" X-IronPort-AV: E=Sophos;i="6.04,186,1695711600"; d="scan'208";a="782637317" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 05:07:32 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , stable@vger.kernel.org Subject: [PATCH v2] wifi: iwlwifi: fix a memory corruption Date: Thu, 11 Jan 2024 15:07:25 +0200 Message-Id: <20240111150610.2d2b8b870194.I14ed76505a5cf87304e0c9cc05cc0ae85ed3bf91@changeid> X-Mailer: git-send-email 2.34.1 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: Emmanuel Grumbach iwl_fw_ini_trigger_tlv::data is a pointer to a __le32, which means that if we copy to iwl_fw_ini_trigger_tlv::data + offset while offset is in bytes, we'll write past the buffer. Cc: stable@vger.kernel.org Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218233 Fixes: cf29c5b66b9f ("iwlwifi: dbg_ini: implement time point handling") Signed-off-by: Emmanuel Grumbach Signed-off-by: Miri Korenblit --- v2: Change 'Link' to 'Closes' drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c index b658cf228fbe..9160d81a871e 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2024 Intel Corporation */ #include #include "iwl-drv.h" @@ -1096,7 +1096,7 @@ static int iwl_dbg_tlv_override_trig_node(struct iwl_fw_runtime *fwrt, node_trig = (void *)node_tlv->data; } - memcpy(node_trig->data + offset, trig->data, trig_data_len); + memcpy((u8 *)node_trig->data + offset, trig->data, trig_data_len); node_tlv->length = cpu_to_le32(size); if (policy & IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG) {