Skip to contentSkip to conversation

PCI/DPC: Fix info->id initialization in dpc_process_error()

RFC PATCH In review Saheed Olayemi Bolarinwa 3 participants 3 messages Oct 31, 2020 – Nov 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 PCI/DPC: Fix info->id initialization in dpc_process_error()

From: "Saheed O. Bolarinwa" <[email protected]>

In the dpc_process_error() path, the error source ID is obtained but not stored inside the aer_err_info object. So aer_print_error() is not aware of the error source if it gets called.

Use the obtained valued to initialise info->id

---
 drivers/pci/pcie/dpc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pcie/dpc.c +1 -0
index e05aba86a317..9f8698812939 100644
@@ -223,6 +223,7 @@ void dpc_process_error(struct pci_dev *pdev)
 	else if (reason == 0 &&
 		 dpc_get_aer_uncorrect_severity(pdev, &info) &&
 		 aer_get_device_error_info(pdev, &info)) {
+		info.id = source;
 		aer_print_error(pdev, &info);
 		pci_aer_clear_nonfatal_status(pdev);
 		pci_aer_clear_fatal_status(pdev);
Signature · 1 line
2.18.4
#1 lore raw
Quoted 7 lines · Saheed Olayemi Bolarinwa

From: "Saheed O. Bolarinwa" <[email protected]>

In the dpc_process_error() path, the error source ID is obtained but not stored inside the aer_err_info object. So aer_print_error() is not aware of the error source if it gets called.

Use the obtained valued to initialise info->id

Is it useful for DPC case ? I don't think we set info->error_dev_num for DPC case right ?

if (info->id && info->error_dev_num > 1 && info->id == id)
726 pci_err(dev, " Error of this Agent is reported first\n");

Quoted 19 lines
---
  drivers/pci/pcie/dpc.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/pcie/dpc.c +1 -0
index e05aba86a317..9f8698812939 100644
@@ -223,6 +223,7 @@ void dpc_process_error(struct pci_dev *pdev)
  	else if (reason == 0 &&
  		 dpc_get_aer_uncorrect_severity(pdev, &info) &&
  		 aer_get_device_error_info(pdev, &info)) {
+		info.id = source;
  		aer_print_error(pdev, &info);
  		pci_aer_clear_nonfatal_status(pdev);
  		pci_aer_clear_fatal_status(pdev);
Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
#2 lore raw
Quoted 7 lines · Sathyanarayanan
Quoted 6 lines · Saheed Olayemi Bolarinwa

From: "Saheed O. Bolarinwa" <[email protected]>

In the dpc_process_error() path, the error source ID is obtained but not stored inside the aer_err_info object. So aer_print_error() is not aware of the error source if it gets called.

Quoted 7 lines
Quoted 1 line

Use the obtained valued to initialise info->id

Is it useful for DPC case ? I don't think we set info->error_dev_num for DPC case right ?

if (info->id && info->error_dev_num > 1 && info->id == id)
726 pci_err(dev, " Error of this Agent is reported first\n");

It's true that we only assign to info->error_dev_num in aer.c. That looks like another defect.

We're passing "info" to aer_print_error() when both info->id and info->error_dev_num are stack junk.

Quoted 22 lines
Quoted 18 lines
---
  drivers/pci/pcie/dpc.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/pcie/dpc.c +1 -0
index e05aba86a317..9f8698812939 100644
@@ -223,6 +223,7 @@ void dpc_process_error(struct pci_dev *pdev)
  	else if (reason == 0 &&
  		 dpc_get_aer_uncorrect_severity(pdev, &info) &&
  		 aer_get_device_error_info(pdev, &info)) {
+		info.id = source;
  		aer_print_error(pdev, &info);
  		pci_aer_clear_nonfatal_status(pdev);
  		pci_aer_clear_fatal_status(pdev);
Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer