Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp81129lqp; Wed, 20 Mar 2024 14:27:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVc0VLfvI7sdGUcV4XFVdokK5BR1rHzpYdZPgGWYX8kKzq7Ln7rF1H3Z+hxYSykDHPKYPgGb2UeISy3UN3EP6Pvm4FFfLk/m25pIQ9YxA== X-Google-Smtp-Source: AGHT+IGozfZyVg26/8JWLo0UsY/tbhya/GmsYSLwHVWmm2BZB5M0LfR1mxJbDIf5sJh4jhw0yrkr X-Received: by 2002:ac8:7e89:0:b0:431:1d8a:1006 with SMTP id w9-20020ac87e89000000b004311d8a1006mr1063903qtj.35.1710970029832; Wed, 20 Mar 2024 14:27:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710970029; cv=pass; d=google.com; s=arc-20160816; b=UdmT9jfCviofw0coB1EbuND+Kz8Phkci0w4p9syGtyXSxM0UegU81hT+GDRb8KbqkL /w2I0EBz4lZzIlPN7IqW9orp80mes0IXiIOQ+FUrlrxy/8jt4FZe5Ued+yUGIDwwTvYf 4ueg9aqG5Bp1Oo7BUrhdDsm+oC8EEQX0hNoxjSZ373e4rkawAKss5kcN2UEC17J/cv5w ADxbt3QsE2OgHNejNrBajEtbyu0iEjhZxOjDDEARtOO3muVL0SiXB3Y6PFlHqBGBdZTf d/0eFAFhipTOYp6A9TYe7GqM3rfvt7nI/1VsatpiFLKd17kIFdOvu1PnzrJZmGeEzfTP T2cQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=8QeDuBWiA6ROBk21FPbSgBl3BfjVOhdL9CgVZCiOruY=; fh=dJyMDUohf5CYvKlAZ8bUHu8yIs3p77pdGvmKrDCiQ/Q=; b=Evv60uASFdii/jkZGODwLxjMlefm4aDKYuj8RxlOrLEIn668uuieQZmulZkb85LIw6 bRHKpx2zlv73ISWkLrh5nMUYnueoEOh/TKlFkFF72yZqHt2fred3XHH2ca/KoEX15piS sRAfNyG7AjXSGKA950wf9rXL30fMUz2dQscbD2wXQ/N3tjpg4dNg9L9u/g9pN7HhEHD3 8YDaMOfTvbILoxskcAFomh3HE8g8ECRtT0Htvl5z8X0jkyq0UCDtT5ZJcIzRBwN7Rm5z qozmS/CZabJ0WzPE/Q/b2d9em3HoXR3zDk0BDER7UUjB9zR4UAhjrM94IS3eNdBcTXBt sQbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LezqsAJi; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-5045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s27-20020a05622a1a9b00b00430bf8499ddsi9886284qtc.130.2024.03.20.14.27.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 14:27:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LezqsAJi; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-5045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8E0361C20E5C for ; Wed, 20 Mar 2024 21:27:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3626D4F8B2; Wed, 20 Mar 2024 21:26:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LezqsAJi" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 465FD85951 for ; Wed, 20 Mar 2024 21:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710970016; cv=none; b=uKG4nWih37Aq29XaYrt7UtxaLA7mxKko0kiJ12BEBS9uglUDPeJoLdT49yodK19W6UxXDFe7xqU6fu6evP+Ny4hUhjrrgDlJ9Cdlv0kY6Llt2sZBMCbGHJ491l9XRACyf7jHUfXHoQMrsuzQh3d0dMEdEOcyM+YkN7xc5zUPSTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710970016; c=relaxed/simple; bh=YloJ0yHJlIYA83FFwU+9/5UNVyNTxXfBF5MfL/9MX3M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dLLTYNuU7toGFFZbRr1gtaZlDqo0+kgEh2De8CetcE2kyoGAKPT5Jj4kUMI9j+UcJ+MjgCq7hc2vrFMD76G/agWTdHd/vTnQSnnH6HRP16AX+w1+BENaOZRVaeEk2BzLYYq3Vn2cqq+WrmPk7D1GsFRS51ZUEDuDy/XwEpz3EtU= 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=LezqsAJi; arc=none smtp.client-ip=192.198.163.12 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710970014; x=1742506014; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YloJ0yHJlIYA83FFwU+9/5UNVyNTxXfBF5MfL/9MX3M=; b=LezqsAJip+BTj4S714/4lICOwH5RY1+HtsmkrGlIwgi1m9tYZNP58FkK TtiYpK6D+/yzTeoBMe+/lf4c3xc3smhkdPmiyQ+iOxywarKGBpfjeFG89 dDW+9QK9DHUtNdi+4vqK6NH/LSF7cXuMqFz7B24/l/DP6WeQH1xJpLl4x KlXWjflFsBGI20pY4rvI7EcmrSMzpKaVWDom27buexnG0dlhNZpjKUbPI TPX6huKb6ZaFZAJc71s3h3DRRQ0HVFuDeeSyQ6QH9MkFCX0U6qjx+vfa7 qtoH+O5yawT1inXgP+7f1UbzV35nWrB1WkukEn+/qJ33/c1cwWgjdroTq Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11019"; a="9698045" X-IronPort-AV: E=Sophos;i="6.07,141,1708416000"; d="scan'208";a="9698045" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 14:26:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,141,1708416000"; d="scan'208";a="14184108" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 14:26:52 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benjamin Berg Subject: [PATCH 02/17] wifi: iwlwifi: mvm: guard against invalid STA ID on removal Date: Wed, 20 Mar 2024 23:26:23 +0200 Message-Id: <20240320232419.d523167bda9c.I1cffd86363805bf86a95d8bdfd4b438bb54baddc@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240320212638.1446082-1-miriam.rachel.korenblit@intel.com> References: <20240320212638.1446082-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 Content-Transfer-Encoding: 8bit From: Benjamin Berg Guard against invalid station IDs in iwl_mvm_mld_rm_sta_id as that would result in out-of-bounds array accesses. This prevents issues should the driver get into a bad state during error handling. Signed-off-by: Benjamin Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c index 6f9ba0c18fa3..4ba1599ed71c 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c @@ -855,10 +855,15 @@ int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id) { - int ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id); + int ret; lockdep_assert_held(&mvm->mutex); + if (WARN_ON(sta_id == IWL_MVM_INVALID_STA)) + return 0; + + ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id); + RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL); return ret; -- 2.34.1