Skip to content

Commit 193b768

Browse files
author
CKI KWF Bot
committed
Merge: s390/pci: Fix stale function handles in error handling
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7167 JIRA: https://issues.redhat.com/browse/RHEL-105598 commits: ``` 4553792 b97a797 ``` Signed-off-by: Mete Durlu <mdurlu@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 315edda + 216c15a commit 193b768

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

arch/s390/pci/pci_event.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ static pci_ers_result_t zpci_event_do_error_state_clear(struct pci_dev *pdev,
106106
struct zpci_dev *zdev = to_zpci(pdev);
107107
int rc;
108108

109+
/* The underlying device may have been disabled by the event */
110+
if (!zdev_enabled(zdev))
111+
return PCI_ERS_RESULT_NEED_RESET;
112+
109113
pr_info("%s: Unblocking device access for examination\n", pci_name(pdev));
110114
rc = zpci_reset_load_store_blocked(zdev);
111115
if (rc) {
@@ -273,6 +277,8 @@ static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
273277
struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
274278
struct pci_dev *pdev = NULL;
275279
pci_ers_result_t ers_res;
280+
u32 fh = 0;
281+
int rc;
276282

277283
zpci_dbg(3, "err fid:%x, fh:%x, pec:%x\n",
278284
ccdf->fid, ccdf->fh, ccdf->pec);
@@ -281,6 +287,15 @@ static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
281287

282288
if (zdev) {
283289
mutex_lock(&zdev->state_lock);
290+
rc = clp_refresh_fh(zdev->fid, &fh);
291+
if (rc)
292+
goto no_pdev;
293+
if (!fh || ccdf->fh != fh) {
294+
/* Ignore events with stale handles */
295+
zpci_dbg(3, "err fid:%x, fh:%x (stale %x)\n",
296+
ccdf->fid, fh, ccdf->fh);
297+
goto no_pdev;
298+
}
284299
zpci_update_fh(zdev, ccdf->fh);
285300
if (zdev->zbus->bus)
286301
pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn);

0 commit comments

Comments
 (0)