]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: mpt3sas: Block PCI config access from userspace during reset
authorSreekanth Reddy <sreekanth.reddy@broadcom.com>
Tue, 30 Mar 2021 10:51:37 +0000 (16:21 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 May 2021 06:39:30 +0000 (08:39 +0200)
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 <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/mpt3sas/mpt3sas_base.c

index ac0eef975f17941f1b57c200365ff7ae61818ae8..b6beacfd0f628b32806f9e58056a672446ba068d 100644 (file)
@@ -7252,6 +7252,8 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
 
        ioc_info(ioc, "sending diag reset !!\n");
 
+       pci_cfg_access_lock(ioc->pdev);
+
        drsprintk(ioc, ioc_info(ioc, "clear interrupts\n"));
 
        count = 0;
@@ -7342,10 +7344,12 @@ _base_diag_reset(struct MPT3SAS_ADAPTER *ioc)
                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;
 }