Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2469685pxj; Mon, 10 May 2021 03:52:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztvrRPFa/6UGQfAvC1RD16cCJlt+PNJZkDoC0FXmdFxqi2qW4Hb7VzvY4auZ6F7C5JvqSA X-Received: by 2002:a05:6e02:1809:: with SMTP id a9mr21271879ilv.184.1620643975711; Mon, 10 May 2021 03:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620643975; cv=none; d=google.com; s=arc-20160816; b=vW4U+aV2Qy2GONsFr1AYYsNw0IBnbcXxwDnfBt3n74Si3/+YAJGFBSWG/3peV9dJ0R UFJs4uu5GXfYILkx8fKodWTlkyhRARNDImxLSaj9hArTNS2ZsPQbAYJHm4m5BE3NQA0U GS04LIIBWykBXMuT3hL664JgG2l+eHEoDCtaqEEFis+dxWO1DSYgPk/QaBHdT5jAXLYH DxM4DsA3pr0kuH1OI3S91oV2P+U5gF4S3Z6Mouc5HXWYW/UpkOhd/Q0olk/XEaQfqaU7 e+3c18paf6oGJdD7O61i0B2Aa5RDfMbIXD0UVN1dQ+57sTZBak5z4eFezD1SRh34qodW I7UA== 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=S4mV2p3Oruzs+1ain/twC1d806YYu7eeweH3/vMHUbU=; b=yN6pgbBCLO3nrYAmLWvLRb0SvC8LJM71K4jd6rBXcN2c8m/fukoyZlqdskeyPFZegE RXeHF+NoUuiMvWEAdi74cdpPpt5lvp9KqVPVNklElpI1nfBy5weyOGjdxIks0obUONQN wl9lQtUrwITRZGSFeilPopJVj8ZzNgvPRVs09GtXAwSPAAxJ/qfFGYuw5Oh/9AkIsVRC NG4n5z8c8XO/GrN7qOmnPpeP2IWdxsaaHeRLKe7mUwIb2pXLQaabIpBHGvU7Shvf10W2 itjtW+VRxOvTgXv8B1ESbe7NM89nQ6KoYII3lFcdtD59juB8D6WsBYirDtSfdgVItAw+ gGtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lj+N5hj8; 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 x13si16909764ilg.80.2021.05.10.03.52.43; Mon, 10 May 2021 03:52:55 -0700 (PDT) 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=lj+N5hj8; 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 S232864AbhEJKwJ (ORCPT + 99 others); Mon, 10 May 2021 06:52:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:48240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231644AbhEJKl2 (ORCPT ); Mon, 10 May 2021 06:41:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 78F0E61976; Mon, 10 May 2021 10:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642730; bh=f06mp27Yvn6EFDPXpYlDHpva7x2neShE+jTtGiHIg5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lj+N5hj87RcsnA51GFQGRy5VK6UO2PzFRLlUBezljLlJNEaUWtwfhI8UdnqdGzwBS 4ezdpoPNLOFDURFA+WhfjnVTj48bPi0m25HgEyFM8FSh4xp+ajDbrWf05UK7HI4BTd A1t25MAXbAXC/2U52gzlpcQNqYV+0m5llOMWINf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sreekanth Reddy , "Martin K. Petersen" Subject: [PATCH 5.10 027/299] scsi: mpt3sas: Block PCI config access from userspace during reset Date: Mon, 10 May 2021 12:17:04 +0200 Message-Id: <20210510102005.744352402@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Sreekanth Reddy commit 3c8604691d2acc7b7d4795d9695070de9eaa5828 upstream. While diag reset is in progress there is short duration where all access to controller's PCI config space from the host needs to be blocked. This is due to a hardware limitation of the IOC controllers. Block all access to controller's config space from userland applications by calling pci_cfg_access_lock() while diag reset is in progress and unlocking it again after the controller comes back to ready state. Link: https://lore.kernel.org/r/20210330105137.20728-1-sreekanth.reddy@broadcom.com Cc: stable@vger.kernel.org #v5.4.108+ Signed-off-by: Sreekanth Reddy Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -6804,6 +6804,8 @@ _base_diag_reset(struct MPT3SAS_ADAPTER ioc_info(ioc, "sending diag reset !!\n"); + pci_cfg_access_lock(ioc->pdev); + drsprintk(ioc, ioc_info(ioc, "clear interrupts\n")); count = 0; @@ -6894,10 +6896,12 @@ _base_diag_reset(struct MPT3SAS_ADAPTER goto out; } + pci_cfg_access_unlock(ioc->pdev); ioc_info(ioc, "diag reset: SUCCESS\n"); return 0; out: + pci_cfg_access_unlock(ioc->pdev); ioc_err(ioc, "diag reset: FAILED\n"); return -EFAULT; }