Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2440078rwd; Wed, 14 Jun 2023 02:54:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Q4iibIJnmV6gVOU8lTZLLUK0PyVEmR/Ss2CmmiDrp1DgIs+IsI+0OlnodolDo+c2GRdtl X-Received: by 2002:a05:6358:9daa:b0:125:7bb3:1c07 with SMTP id d42-20020a0563589daa00b001257bb31c07mr7899186rwo.13.1686736479543; Wed, 14 Jun 2023 02:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686736479; cv=none; d=google.com; s=arc-20160816; b=CrIxHhBm+c5h4Ukozd5mVRlBDvo8ysraIDvQfuQ1+65S1s1DfFU7wxS7iNZRFpLwna W9hLck+IkaHzfgBvJGfm8+kIBSAxgWOf1Q4X5/HXoE7KcuO3q/eyO7O5P/xxfZUCVtmy Z3xp+241csRXfNWe00MXvZeWkQMbkbJxwWoa7cPKcCiz/BMDgTEn72JpXqjORW17RoGD kXplC2jXqYPYv8kFLGkpdNcXiRnG81K/tOQNhtxf3BVe/ySMoByrOtbK1cKrY48wp1qF lqqMNklm+NsO4HrrQIFpe1lTqatIk4uRCkHwOyllBh74zoeRJZyc1kp4GuzcrknYCQQZ uy0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pUeIfEW4FiUKYLrcGqJTy+tY12X9IGdIaPpZ/sox54A=; b=U27HQE0sKcimiVkw+RT7vewU0/8JQadSPFMO32/FXoRIbla+jg6w4UOsATm7B0mYEb FnG+hbL9hl10JzIhc9W6vcQVIBgA9OtVtWqDi+t4dp4LHSlXK8DXq1Rd7VmmdTortIqN 663x5n+Fdqz4BMeAduNduXd4QBzpRuUdBgFoyvYK6Xjt8RC8xXQwvnzliKnjyxVcHo7M vkLEGUSxPDEGPJq9HxScb9FDK7M5DGLVpUzX1L6wXUwzWWkW+dKagr4/NrvNDoBaxcUy YHnACAGEA6zT2de1aE1gjeUj6U58cW3bVdjjD3itMQLUQGucFRwia4n3twBo5JUgelZV qNjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QODE+VnD; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u186-20020a6385c3000000b00520dfb861fbsi10656372pgd.416.2023.06.14.02.54.32; Wed, 14 Jun 2023 02:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QODE+VnD; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244185AbjFNJpl (ORCPT + 61 others); Wed, 14 Jun 2023 05:45:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244321AbjFNJou (ORCPT ); Wed, 14 Jun 2023 05:44:50 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D20902723 for ; Wed, 14 Jun 2023 02:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686735835; x=1718271835; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NlcAj/sfb++wMa9QOjH86EhMcnCKswW7vniAtGATU+k=; b=QODE+VnDvM5EaQFuJWLc5MK54tkhPSLel6qMDGZy/YMyjliZjheNVQ5m C1Mff7fYDLYAB5VBnb6N1CFlW+JCdhg8zxeiqgp+UX/Czv72KjM3L4B0G QSxAuA7ajhVVt9PPMx8GKYzJU3RS1GFEjQdnGnGh+5bdKWDbSbSfqHTpu Wb8ApkeLqXiqvGCSf2s97uiWExdoqFeKNlA0Gp9SWeo970oar4E1lEOxM JG1IQg/Tmz7svApADQ8jPMqpl1XAHosHRdv+TYnLuKkFUoeVSdQsyubtu pBxryhtM+oPgq2E4f4Rj+MPS7WuyNxiTo0A/hBj0edIzdYqbmyt6NdkhT w==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="361049886" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="361049886" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 02:42:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="711989894" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="711989894" Received: from basharil-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.214.203.45]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 02:42:27 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Anjaneyulu , Gregory Greenman Subject: [PATCH 15/20] wifi: iwlwifi: pcie: fix NULL pointer dereference in iwl_pcie_irq_rx_msix_handler() Date: Wed, 14 Jun 2023 12:41:32 +0300 Message-Id: <20230614123446.5a5eb3889a4a.I375a1d58f16b48cd2044e7b7caddae512d7c86fd@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230614094137.379897-1-gregory.greenman@intel.com> References: <20230614094137.379897-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Anjaneyulu rxq can be NULL only when trans_pcie->rxq is NULL and entry->entry is zero. For the case when entry->entry is not equal to 0, rxq won't be NULL even if trans_pcie->rxq is NULL. Modify checker to check for trans_pcie->rxq. Fixes: abc599efa67b ("iwlwifi: pcie: don't crash when rx queues aren't allocated in interrupt") Signed-off-by: Anjaneyulu Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c index 4ee4886babcb..da1a27b1d8b6 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -1636,14 +1636,14 @@ irqreturn_t iwl_pcie_irq_rx_msix_handler(int irq, void *dev_id) struct msix_entry *entry = dev_id; struct iwl_trans_pcie *trans_pcie = iwl_pcie_get_trans_pcie(entry); struct iwl_trans *trans = trans_pcie->trans; - struct iwl_rxq *rxq = &trans_pcie->rxq[entry->entry]; + struct iwl_rxq *rxq; trace_iwlwifi_dev_irq_msix(trans->dev, entry, false, 0, 0); if (WARN_ON(entry->entry >= trans->num_rx_queues)) return IRQ_NONE; - if (!rxq) { + if (!trans_pcie->rxq) { if (net_ratelimit()) IWL_ERR(trans, "[%d] Got MSI-X interrupt before we have Rx queues\n", @@ -1651,6 +1651,7 @@ irqreturn_t iwl_pcie_irq_rx_msix_handler(int irq, void *dev_id) return IRQ_NONE; } + rxq = &trans_pcie->rxq[entry->entry]; lock_map_acquire(&trans->sync_cmd_lockdep_map); IWL_DEBUG_ISR(trans, "[%d] Got interrupt\n", entry->entry); -- 2.38.1