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>
This commit is contained in:
Родитель
20151169f1
Коммит
20acebdfae
|
@ -820,14 +820,15 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose)
|
||||||
struct OpalIoPhbErrorCommon *common;
|
struct OpalIoPhbErrorCommon *common;
|
||||||
long rc;
|
long rc;
|
||||||
|
|
||||||
common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
|
rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
|
||||||
rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE);
|
PNV_PCI_DIAG_BUF_SIZE);
|
||||||
if (rc != OPAL_SUCCESS) {
|
if (rc != OPAL_SUCCESS) {
|
||||||
pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",
|
pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",
|
||||||
__func__, hose->global_number, rc);
|
__func__, hose->global_number, rc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
|
||||||
switch (common->ioType) {
|
switch (common->ioType) {
|
||||||
case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
|
case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
|
||||||
ioda_eeh_p7ioc_phb_diag(hose, common);
|
ioda_eeh_p7ioc_phb_diag(hose, common);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче