diff options
author | Brian W Hart <hartb@linux.vnet.ibm.com> | 2013-12-19 18:14:07 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-12-29 22:02:31 -0500 |
commit | 20acebdfaec3e15d8a27ab25bf4a2f91b2afa757 (patch) | |
tree | b0597334620062b4f406c04d6e28f2afe2b44dc3 /arch | |
parent | 20151169f1de4b170368fdb574024027620d0d49 (diff) |
powernv/eeh: Fix possible buffer overrun in ioda_eeh_phb_diag()
PHB diagnostic buffer may be smaller than PAGE_SIZE, especially when
PAGE_SIZE > 4KB.
Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com>
Acked-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/platforms/powernv/eeh-ioda.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c index 02245cee7818..8184ef5ccb1a 100644 --- a/arch/powerpc/platforms/powernv/eeh-ioda.c +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c | |||
@@ -820,14 +820,15 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose) | |||
820 | struct OpalIoPhbErrorCommon *common; | 820 | struct OpalIoPhbErrorCommon *common; |
821 | long rc; | 821 | long rc; |
822 | 822 | ||
823 | common = (struct OpalIoPhbErrorCommon *)phb->diag.blob; | 823 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, |
824 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE); | 824 | PNV_PCI_DIAG_BUF_SIZE); |
825 | if (rc != OPAL_SUCCESS) { | 825 | if (rc != OPAL_SUCCESS) { |
826 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", | 826 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", |
827 | __func__, hose->global_number, rc); | 827 | __func__, hose->global_number, rc); |
828 | return; | 828 | return; |
829 | } | 829 | } |
830 | 830 | ||
831 | common = (struct OpalIoPhbErrorCommon *)phb->diag.blob; | ||
831 | switch (common->ioType) { | 832 | switch (common->ioType) { |
832 | case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: | 833 | case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: |
833 | ioda_eeh_p7ioc_phb_diag(hose, common); | 834 | ioda_eeh_p7ioc_phb_diag(hose, common); |