summaryrefslogtreecommitdiffstats
path: root/arch/s390/pci
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2015-07-28 19:11:40 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-07-29 09:11:52 +0200
commit515f022e8b59ce928fe5d82affb3e93ab53d12ed (patch)
treecc84e1aba2bcc35fb17ce043d582cd48290d6d36 /arch/s390/pci
parent2b1df72416a858f928c4edcbbb7f13b8dfc10a35 (diff)
downloadlinux-515f022e8b59ce928fe5d82affb3e93ab53d12ed.tar.bz2
s390/pci: handle events for unused functions
Receiving error events for a pci function that's currently not in use will crash the kernel. For example the procedure for FW upgrades might include: * remove the function from Linux * apply FW upgrade * rescan for new functions Receiving an event during the FW upgrade will result in a use after free when printing the functions name. Just print "n/a" in such cases. Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/pci')
-rw-r--r--arch/s390/pci/pci_event.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/s390/pci/pci_event.c b/arch/s390/pci/pci_event.c
index ed2394dd14e9..eef76f0e6873 100644
--- a/arch/s390/pci/pci_event.c
+++ b/arch/s390/pci/pci_event.c
@@ -46,15 +46,13 @@ struct zpci_ccdf_avail {
static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
{
struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
+ struct pci_dev *pdev = zdev ? zdev->pdev : NULL;
zpci_err("error CCDF:\n");
zpci_err_hex(ccdf, sizeof(*ccdf));
- if (!zdev)
- return;
-
pr_err("%s: Event 0x%x reports an error for PCI function 0x%x\n",
- pci_name(zdev->pdev), ccdf->pec, ccdf->fid);
+ pdev ? pci_name(pdev) : "n/a", ccdf->pec, ccdf->fid);
}
void zpci_event_error(void *data)