Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3648699pxb; Mon, 24 Jan 2022 14:23:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJPWetzmptMuZfwpe8RZPLd9kTns4+1RkfGU/zuDopVTT3f+IBqjAE33NnvZpmtTMl7U54 X-Received: by 2002:a17:902:e5c5:b0:14b:1bbb:9f5 with SMTP id u5-20020a170902e5c500b0014b1bbb09f5mr15587457plf.62.1643063011203; Mon, 24 Jan 2022 14:23:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063011; cv=none; d=google.com; s=arc-20160816; b=ocz4CuQO1clO+rR22fwn+H0xWdLkOd62+hvO/K6Ii7wr97MGzKRnDeizCKtAlVdlMv kdyRSkxa8VQIT3EenpLPS9VkBDMgjWUUH/tEwDQr2gvBb9usCA0xvPfwHbnWO72tJYrY qiODeBSzUZ3TXdyLQjD7yQ8YMPO6OXV4s8ngdmsOikFyhPNdDuirlolsP6f8IwoAAgsa N+XhLxoh3EHU0uwSaxiflixXmiLrsZ75PQf2HBDRBrOXH5DlqZo8euEsCWchYasWU4J8 kl/WmPIW8Da1tP+VxkFn+RGl9kJmXo67rg+2e7jHt0/+5X1ULbeAvUh3jH6sUiDXSzmx leFQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jQi9k4YP59VgZpS5X4Ym2cV+9zCERzhRRqozs9+dmHM=; b=ECod3WdLUa0+il2NYHstCWAFjP1ryjBgSwDn0Sx/st5Dh5bqBdbgRY8sXhrgaOsgeg 2ZJl59qpisj3D6g+u89f80SyDfcZ2iwZmjWHGbtckQ5zMqMvFR5UDv3Z0eG2DWCNUJ6G U9FLgNrocuLTEYThdoTTl524azJgPp5hxHqKuH1wwgZKm1QwweqVx4HybrOwMntpJeF3 f8HK6M+MmtkAcPKsMxVcSJlFc8pnM2SzxPfSE2DdqBRorOUldr0xb+YjWkH7t+cz5wQ5 AxrGqy/smDUE5XDActu3Soz/AfThDHxI0MwceNjlCdjHvIocW2upcrLHoH5UH0oDt4SC uCvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tg4X64ZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si483876pjq.111.2022.01.24.14.23.18; Mon, 24 Jan 2022 14:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tg4X64ZC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1581680AbiAXWMJ (ORCPT + 99 others); Mon, 24 Jan 2022 17:12:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:42586 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452970AbiAXV1b (ORCPT ); Mon, 24 Jan 2022 16:27:31 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FCA2B81218; Mon, 24 Jan 2022 21:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6292C340E4; Mon, 24 Jan 2022 21:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059648; bh=t24xaTbX/YPgqubRwPSZulUBEsrmp1dBDxvvqQabvmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tg4X64ZC96dazK6u20I8v7YGFaxr/eyAldXPyzavse1p7mth+gc9hK/behkJ9xZCd fhTYm1mKFMqflsLDf+WcVpvrB2qPzAyVw6cw9JjQlanoKjV84Y3PefhTYApsTXL0wz ZlJAcwQbRo8M3ersHzwhujodAI+KI255FpmRyxt4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Coelho , Sasha Levin Subject: [PATCH 5.16 0685/1039] iwlwifi: pcie: make sure prph_info is set when treating wakeup IRQ Date: Mon, 24 Jan 2022 19:41:14 +0100 Message-Id: <20220124184148.376711013@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luca Coelho [ Upstream commit 459fc0f2c6b0f6e280bfa0f230c100c9dfe3a199 ] In some rare cases when the HW is in a bad state, we may get this interrupt when prph_info is not set yet. Then we will try to dereference it to check the sleep_notif element, which will cause an oops. Fix that by ignoring the interrupt if prph_info is not set yet. Signed-off-by: Luca Coelho Link: https://lore.kernel.org/r/iwlwifi.20211219132536.0537aa562313.I183bb336345b9b3da196ba9e596a6f189fbcbd09@changeid Signed-off-by: Luca Coelho Signed-off-by: Sasha Levin --- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c index 14602d6d6699f..8247014278f30 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c @@ -2266,7 +2266,12 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id) } } - if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP) { + /* + * In some rare cases when the HW is in a bad state, we may + * get this interrupt too early, when prph_info is still NULL. + * So make sure that it's not NULL to prevent crashing. + */ + if (inta_hw & MSIX_HW_INT_CAUSES_REG_WAKEUP && trans_pcie->prph_info) { u32 sleep_notif = le32_to_cpu(trans_pcie->prph_info->sleep_notif); if (sleep_notif == IWL_D3_SLEEP_STATUS_SUSPEND || -- 2.34.1